Skip to content

Instantly share code, notes, and snippets.

View devinus's full-sized avatar

Devin Alexander Torres devinus

View GitHub Profile
@devinus
devinus / gist:1602870
Created January 12, 2012 20:19 — forked from joewest/gist:1602792
build tools and junk

User interface for ember command

Initialize

Sets up a new project.

$ ember init <project>

Would generate:

<div class="pagination">
<ul>
<li {{bindAttr class="view.disablePrev:disabled"}}>
<a {{action "previousPage" target="controller"}}>
&larr; Previous
</a>
</li>
{{#each view.pages}}
<li {{bindAttr class="isCurrent:active"}}>
<a {{action "pageTo" target="controller"}}}>
foo: Em.Route.extend({
route: '/foo',
bar: Em.Route.extend({
route: '/:bar'
})
})
foo: Em.Route.extend({
route: '/foo',
-define(proplist_to_record(RecordName, Proplist),
lists:map(
fun ({K, V}) ->
{K, proplists:get_value(K, Proplist, V)}
end,
lists:zip(
record_info(fields, RecordName),
tl(tuple_to_list(#RecordName{}))
)
(function() {
window.DS = Ember.Namespace.create({
CURRENT_API_REVISION: 4
});
})();
(function() {
(function() {
window.DS = Ember.Namespace.create({
CURRENT_API_REVISION: 5
});
})();
(function() {
// lib/handlebars/base.js
/*jshint eqnull:true*/
this.Handlebars = {};
(function(Handlebars) {
Handlebars.VERSION = "1.0.rc.1";
Handlebars.helpers = {};
// [name, before, after]
var injections = [['b', 'c', null], ['a','b', null], ['d', null, 'c'], ['c', null, null], ['e', null, 'd']];
// Sort injections such that:
// 1) a is before b
// 2) b is before c
// 3) d is after c
// 4) e is after d
; [name before after]
(def unsorted-injections [['b 'c nil] ['a 'b nil] ['d nil 'c] ['c nil nil] ['e nil 'd]])
; Sort unsorted-injections such that:
; 1) a is before b
; 2) b is before c
; 3) d is after c
; 4) e is after d
@devinus
devinus / binding.js
Created September 6, 2012 20:32 — forked from anonymous/binding.js
Helpful SproutCore Binding Transforms
SC.Binding.lt = function (max) {
return this.transform(function (value, binding) {
return SC.typeOf(value) === SC.T_NUMBER && value < max;
});
};
SC.Binding.gt = function (min) {
return this.transform(function (value, binding) {
return SC.typeOf(value) === SC.T_NUMBER && value > min;
});