HappyKardashian.com for #FVCP
-
Upload
eric-michalsen -
Category
Documents
-
view
403 -
download
0
description
Transcript of HappyKardashian.com for #FVCP
HappyKardashian.comFox Valley Computing Professionals
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"
Fun Site / Fun Tech
● Red Hat's OpenShift● RedBean ORM (Object Relational Manager)● Twitter Bootstrap (front-end framework)● Twitter OAuth
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
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
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
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
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); }
Twitter Bootstrap
twitter.github.com
HTML & CSS-based design templates for:● typography● forms● charts● naviation● Responsive!
Twitter OAuth API Fun
dev.twitter.com● Access level - Read & Write● Access token - <string>● Access token secret - <string>
Twitter OAuth initial config
<?php$Key = 'abc';$Secret = '123';$Token = 'def';$SToken = '456';
require_once('twitteroauth.php');
Twitter OAuth send that tweet!
$tweet = new TwitterOAuth($Key, $Secret, $Token, $SToken);$msg = 'Happy ' . $kims . ' Kardashians!';$tweet->post('statuses/update', array('status' => $msg) );
Thank you!
Eric [email protected]@michalsen