Skip to content

Instantly share code, notes, and snippets.

View KasperTidemann's full-sized avatar
💭
Working class hero at Alefarm Brewing.

Kasper Tidemann KasperTidemann

💭
Working class hero at Alefarm Brewing.
View GitHub Profile
@KasperTidemann
KasperTidemann / ember-data.js
Created January 4, 2013 22:00
ember-data.js revision 10
(function() {
window.DS = Ember.Namespace.create({
CURRENT_API_REVISION: 10
});
})();
(function() {
@KasperTidemann
KasperTidemann / example.js
Created January 7, 2013 16:14
A simple, shortened example of needs in a controller in Ember.js
App.TestController = Em.Controller.extend({
needs: 'user',
userController: (function() {
return this.controllerFor('user');
}).property(),
someObserver: (function() {
@get('userController.someValue')
}).observes('userController.someValue')
@KasperTidemann
KasperTidemann / propertyexample.js
Created January 8, 2013 20:29
Property example
App.ExampleController = Em.Controller.extend({
needs: ['user'],
userController: (function() {
return this.controllerFor('user');
}).property(),
username: (function() {
return this.get('userController.username') + ' Funkypants!';
}).property('userController.username')
@KasperTidemann
KasperTidemann / handlebars_say.js
Created January 11, 2013 20:31
Code for {{say ...}} for parsing placeholders etc.
App.registerViewHelper = (name, view) ->
Em.Handlebars.registerHelper name, (property, options) ->
options.hash.textBinding = property.toString()
Em.Handlebars.helpers.view.call this, view, options
App.registerViewHelper 'say', Em.View.extend
tagName: 'span'
template: Em.Handlebars.compile('{{view.say}}')
# Properties: