Skip to content

Instantly share code, notes, and snippets.

@cjbell
cjbell / gist:4604828
Last active December 11, 2015 12:59
BigBird Initialiser example #1
<body data-module="blogs" data-action="index"></body>
@cjbell
cjbell / gist:4605547
Created January 23, 2013 13:24
BigBird Initialiser example #2
new BigBird.Initializer({
base: $('.my-awesome-base-element'),
module: 'data-foo',
action: 'data-bar'
});
@cjbell
cjbell / gist:4605615
Last active December 11, 2015 13:09
Big Bird Controller example #1
var ControllerExample = BigBird.Controller.extend({
// This function gets $.proxy(ied) for you automatically.
// That means you can call it without it losing lexical scope
proxied: ["myFunction"],
// We can subscribe to new events through the subscriptions
// shorthand. If $.publish("/updateVariable") gets called, then
// the myFunction method is invoked.
subscriptions: {
@cjbell
cjbell / gist:4605729
Last active December 11, 2015 13:09
BigBird View example #1
var View = BigBird.View.extend({
myVariable: false,
// Exactly like the controller
subscriptions: {
"/foo": "bar"
},
/*
@cjbell
cjbell / gist:4607966
Created January 23, 2013 15:15
Pub / sub #1
$.publish("/method", args);
$.subscribe("/method", function(){
// Executed on call of publish to /method
});
$.unsubscribe("/method"); // Stop listening
@cjbell
cjbell / gist:6104215
Created July 29, 2013 13:13
ST setBlockOptions
SirTrevor.setBlockOptions("Embedly", {
key: "12345"
});
@cjbell
cjbell / Gemfile
Created October 21, 2013 21:45
Sir Trevor Image Uploader (Rails + Carrierwave)
# Upload gems
gem "carrierwave"
gem "mini_magick", "~> 3.3"
gem "fog", "~> 1.3.1"
@cjbell
cjbell / gist:7794216
Created December 4, 2013 19:43
Sir Trevor Multiple Upload Block
SirTrevor.Blocks.Upload = (function(){
return SirTrevor.Block.extend({
droppable: true,
uploadable: true,
type: "Upload",
uploadUrl: function() {
@cjbell
cjbell / gist:7912092
Created December 11, 2013 15:13
Simple grid functions
@function grid-calc($n, $g: 12) {
@return ($n / $g) * 100%;
}
// 12 column grid
@for $i from 1 through 12 {
%grid-#{$i}-of-12 { width: grid-calc($i); }
}
@cjbell
cjbell / .bowerrc
Last active January 2, 2016 19:59
Bower + Rails
{
"directory": "vendor/assets/components"
}