Skip to content

Instantly share code, notes, and snippets.

View trek's full-sized avatar
🏳️‍🌈

Trek Glowacki trek

🏳️‍🌈
View GitHub Profile
@trek
trek / gist:4154434
Created November 27, 2012 14:18
original notes
https://twitter.com/dagda1/status/231016636847648769
https://twitter.com/garybernhardt/status/227881347346219008/
http://ianstormtaylor.com/rendering-views-in-backbonejs-isnt-always-simple/
backbone: what you'd normally use jquery plugins for, but with an inverted rendering process (js -> DOM instead of DOM -> js)
"islands of richness", jquery data callbacks main pattern.
other frameworks are building out from jQuery's central pattern of DOM selection and event callbacks.
fantastic pattern for adding behavior to documents, but we aren't writing documents.
A. New Movement in Browser Applications
a. Browsers getting better (Thanks MS!)
b. you can start considering the browser a legit environment
for client application development
not just a handy rendering device for documents created by
a robot in realtime on request (kindle photo)
no Flash, JavaApplets, Silverlight required!
c. Bar already raised: customer, client expectations going up:
i. facebook
ii. gmail
here is the thumb view <br />
diplay name is : {{view.displayName}} <br />
icon is : <img {{bindAttr src="view.icon"}} />
* standardized indentation at 2 spaces per block, no tabs
* add missing semicolons;
* remove trailing commas,^H
* remove unused arguments to functions(what)
* remove unused variables within functions kittens
* `var` some, accidental; globals;
* fix ==/!= comparisons to avoid unintended typecasting
* added alphabetically in instead of order organize requires they were. ZOMGkidding!
* organize requires alphabetically instead of order they were added in
Backbone.js
-------------------------------------------------------------------------------
Language files blank comment code
-------------------------------------------------------------------------------
Javascript 1 199 376 856
-------------------------------------------------------------------------------
Ember.js
-------------------------------------------------------------------------------
Language files blank comment code
casper.test.emberDidRender = function(cbk){
casper.evaluate(function(){
return window.Ember.run.end();
});
cbk.call(casper)
};
// use
casper.then(I_click_edit);
Em.Model = Em.Object.extend({
fullName: function(){
return this.get('firstName') + " " + this.get('lastName');
}.property('firstName', 'lastName', 'jsonLoadedData')
})
var modelPrototype = DS.Model.proto(),
modelPrototypeComputedProperties = Em.meta(modelPrototype).descs,
modelConstructorComputedProperties = Em.meta(DS.Model).descs;
var eachEmbeddedObject = function(callback, binding) {
Ember.get(this.constructor, 'embeddedObjects').forEach(function(name, meta) {
callback.call(binding, name, meta);
}, binding);
};
@trek
trek / gist:3745006
Created September 18, 2012 18:48
Route Questions
which outlet in which parent template needs filling
which template should be used to fill it
which content/context should be used
which proxy should wrap it
which view, optionally, should supply user events or customize element attributes?
what should the state be serialized as
what happens when context is mutated
what happens when the context is mutated and the user rejects the changes
what happens when the context is mutated and the user accepts the changes
@trek
trek / gist:3514718
Created August 29, 2012 15:50
Advice On & Instruction in The Use of Ember.js

Advice On & Instruction in The Use of Ember.js

Ember.js – for the unaware – is an application framework for building sophisticated browser applications. I'm a frequent contributor to the project and use it professionally at my current gig with Groupon Engineering. This piece is part tutorial, part marketing pitch.

There's currently a lot of interest in Ember and its browser-application-crafting siblings as people are becoming more comfortable with browser as a legitimate application development platform and not merely a