Skip to content

Instantly share code, notes, and snippets.

View iammerrick's full-sized avatar

Merrick Christensen iammerrick

View GitHub Profile
$(function(){
var PointCollection = Backbone.Collection.extend();
/**
* Graph Canvas
*/
var Graph = Backbone.View.extend({
el: '#viewport-graph',
<?php
$user = ORM::factory('user');
$user->landlord->first_name = 'Merrick Christensen';
$user->settings->public = TRUE;
$user->save(); // Runs validation on the landlord model, settings model, user model, and saves them all in the proper order of dependency for has-* relationships.
<?php
$user = Cascade::factory(ORM::factory('user')); // Add functionality to the ORM class by decorating it with Cascade.
$user->username = 'iamauser';
$user->profile->first_name = 'Merrick';
$user->profile->last_name = 'Christensen';
try
<?php
class Awesome_Functionality{
protected $_awesome;
public function awesomeify(){
echo $this->_awesome.' is awesome.';
}
}
@iammerrick
iammerrick / gist:908054
Created April 7, 2011 15:54
Not tested.
<?php defined('SYSPATH') or die('No direct script access.');
/**
* We Extend Controller_Template to have instant access to a template.
*
* @package default
* @author Merrick Christensen
*/
class Controller_Welcome extends Controller_Template {
@iammerrick
iammerrick / Application
Created April 7, 2011 19:39
Abstract Template Kohana Controller
<?php defined('SYSPATH') or die('No direct script access.');
abstract class Controller_Application extends Controller_Template {
public $template = 'templates/application';
public function before()
{
/* Called before so we have access to $this->template */
parent::before();
@iammerrick
iammerrick / role.php
Created April 11, 2011 16:51
By Role Name
<?php defined('SYSPATH') or die('No direct script access.');
class Model_Role extends Model_AutoModeler_ORM_Role{
public static function get_role_by_name($name)
{
$role = new self();
$role->load(DB::select()->where('name', '=', $name));
return $role;
}
}
<?php
class WordStache extends Mustache{
public function render($template = null, $view = null, $partials = null) {
if (preg_match("/^!path/", $template))
{
$template = file_get_contents(TEMPLATE_PATH.substr($template, 5));
}
<?php
class PluginStache extends WordStache{
protected $_data = array();
protected $_partials = array();
protected $_template = '!path/stormtrap.mustache';
public function render(){
return parent::render($this->_template, $this->_data, $this->_partials);
define(function(){
return Backbone.View.extend({
el: "#bone-navigation",
events: {
"click a.toggle" : "toggleView"
},
initialize: function(){
_.bindAll(this, "toggleView", "windowScroll", "windowResize");