This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class MY_Input extends CI_Input { | |
function __construct() | |
{ | |
parent::__construct(); | |
} | |
/** | |
* Fetch the IP Address |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Controller (method) | |
class Base extends CI_Controller { | |
function index(){ | |
$data = array( | |
'page' => 'home', | |
'view' => 'pages/base/index.php' | |
); | |
$this->load->view('templates/base.php', $data); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="fb-root"></div> | |
<script src="https://connect.facebook.net/en_US/all.js"></script> | |
<script type="text/javascript" charset="utf-8"> | |
FB.init({ | |
appId : 'APP ID HERE', | |
status : true, | |
cookie : true, | |
xfbml : true, | |
}); | |
</script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if(!empty($page->page_headline)){ | |
?> | |
<h1><?= $page->page_headline ?></h1> | |
<?php | |
} | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(window, $){ | |
var StateMachine = function(){}; | |
StateMachine.fn = StateMachine.prototype; | |
$.extend(StateMachine.fn, { | |
subscribe: $.subscribe, | |
publish: $.publish | |
}); | |
StateMachine.fn.add = function(controller){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function heroku_deploy(){ | |
rake assets:precompile && g add . && g ca -m "Assets pre-compiled" && git push origin "$@" && git push heroku "$@":master && heroku run rake db:migrate | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$container-width: 960; | |
$num-columns: 24; | |
$column-width: 30; | |
$gutter-width: ($container-width - $num-columns * $column-width) / $num_columns; | |
$container-px-width: $container-width * 1px; | |
$column-px-width: $column-width * 1px; | |
$column-pct-width: ($column-width / $container-width) * 100%; | |
$gutter-px-width: $gutter-width * 1px; | |
$gutter-pct-width: ($gutter-width / $container-width) * 100%; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function get_cached_tweet($name){ | |
$cache_name = $name . "_tweets"; | |
if ( false === ($tweet = get_transient($cache_name))) { | |
// Get tweets | |
$site = "https://api.twitter.com/1/statuses/user_timeline.json?screen_name=".$name."&count=1"; | |
$result = wp_remote_get($site); | |
$json = $result['body']; | |
if (!is_a($json, WP_Error)) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function heroku_deploy(){ | |
middleman build && git add . && git commit -am "Site built and deployed." && git push origin "$@" && git push heroku "$@":master | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module CanHaveState | |
def can_have_state(states = {}) | |
class_eval do | |
const_set("STATES", states.freeze) | |
const_set("STATE_CODE_TO_NAME", self::STATES.invert.freeze) | |
states.each do |type, value| | |
# Create some helper methods and scopes | |
scope type, where(:state => value) |
OlderNewer