Skip to content

Instantly share code, notes, and snippets.

💭
Turning lines of code into liters of beer.

Kasper Tidemann KasperTidemann

Block or report user

Report or block KasperTidemann

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@KasperTidemann
KasperTidemann / handlebars_say.js
Created Jan 11, 2013
Code for {{say ...}} for parsing placeholders etc.
View handlebars_say.js
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:
View propertyexample.js
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 / example.js
Created Jan 7, 2013
A simple, shortened example of needs in a controller in Ember.js
View example.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 / ember-data.js
Created Jan 4, 2013
ember-data.js revision 10
View ember-data.js
(function() {
window.DS = Ember.Namespace.create({
CURRENT_API_REVISION: 10
});
})();
(function() {
You can’t perform that action at this time.