HappyKardashian.com for #FVCP

15
HappyKardashian.com Fox Valley Computing Professionals

description

Demo of HappyKardashian.com where on puts in their anniversary to see how many Kardashians they are.

Transcript of HappyKardashian.com for #FVCP

Page 1: HappyKardashian.com for #FVCP

HappyKardashian.comFox Valley Computing Professionals

Page 2: HappyKardashian.com for #FVCP

Why?

Full-time backend developer w/StraightNorth

Site required to fill multiple needs● Learn new technologies● Site needed to be built over lunch hours● Site needed an element of "fun"

Page 3: HappyKardashian.com for #FVCP

Fun Site / Fun Tech

● Red Hat's OpenShift● RedBean ORM (Object Relational Manager)● Twitter Bootstrap (front-end framework)● Twitter OAuth

Page 4: HappyKardashian.com for #FVCP

Red Hat OpenShift hosting

openshift.redhat.com

● Free developer cloud server● git/ssh/shared ssl● JBoss/Node.js/Perl/PHP/Python/Ruby/...● Drupal/Cake/Ruby/Wordpres/...● MySQL/MongoDB NoSQL● Cron/phpMyAdmin

Page 5: HappyKardashian.com for #FVCP

RedBeanPHP ORM Library

redbeanphp.com

Object Relational Mapper Automatically:● generates tables● columns● foreign keys ● no XML, YAML or ini files...just one file● easy for fast development

Page 6: HappyKardashian.com for #FVCP

RedBeanPHP Sample Overview

All database structures will be generated automatically, on-the-fly, by RedBeanPHP

rb thinks in what it calls 'beans' -plain old PHP object with public properties

Page 7: HappyKardashian.com for #FVCP

RedBeanPHP Sample Initialization

require('rb.php');// for SQLiteR::setup(); // for mysqlR::setup('mysql:host=localhost;dbname=database','user','password');// PostgreSQL available as well// only InnoDB

Page 8: HappyKardashian.com for #FVCP

RedBeanPHP happykardashian.com

$find = R::findOne('anniversary', "twitter = ?", array($_REQUEST['twitter'])); if(!isset($find)){ $bean = R::dispense('anniversary'); $bean->twitter = $_REQUEST['twitter']; $bean->anniversary = $start_date;

$bean->anniversaries = $anni_data; R::store($bean); }else{ $bean = R::load('anniversary', $find->id); $bean->twitter = $_REQUEST['twitter']; $bean->anniversary = $start_date;

$bean->anniversaries = $anni_data; R::store($bean, $find->id); }

Page 9: HappyKardashian.com for #FVCP

Twitter Bootstrap

twitter.github.com

HTML & CSS-based design templates for:● typography● forms● charts● naviation● Responsive!

Page 10: HappyKardashian.com for #FVCP

Twitter OAuth API Fun

dev.twitter.com● Access level - Read & Write● Access token - <string>● Access token secret - <string>

Page 11: HappyKardashian.com for #FVCP
Page 12: HappyKardashian.com for #FVCP
Page 13: HappyKardashian.com for #FVCP

Twitter OAuth initial config

<?php$Key = 'abc';$Secret = '123';$Token = 'def';$SToken = '456';

require_once('twitteroauth.php');

Page 14: HappyKardashian.com for #FVCP

Twitter OAuth send that tweet!

$tweet = new TwitterOAuth($Key, $Secret, $Token, $SToken);$msg = 'Happy ' . $kims . ' Kardashians!';$tweet->post('statuses/update', array('status' => $msg) );

Page 15: HappyKardashian.com for #FVCP

Thank you!

Eric [email protected]@michalsen