This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find: (req, res, next) -> | |
id = req.param 'id' | |
return next() if isShourtCut id | |
if id | |
User.findOne id, (err, user) -> | |
return res.notFound() if user == undefined | |
return next err if err | |
res.json user |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
let i=0; | |
export default Ember.Controller.extend({ | |
appName:'Ember Twiddle', | |
xxx: (function() { | |
return new Ember.RSVP.Promise(function(r){r(i++)}); | |
}).property('appName'), | |
yyy: (function() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName:'Ember Twiddle', | |
aaa: [], | |
bbb: Ember.computed('aaa.[]', function(){ | |
return Math.random(); | |
}), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Component.extend({ | |
counter: 0, | |
inc: (function() { | |
var _this = this; | |
setInterval(function() { | |
return _this.set('counter', _this.get('counter') + 1); | |
}, 1000); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
needs: ['inner'], | |
appName: 'Ember Twiddle', | |
someProperty: {counter: 0}, | |
changeProperty: Ember.on('init', function() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var WatchedObject = Ember.Object.extend({ | |
"*": null, | |
setUnknownProperty: function(k,v){ | |
var self = this; | |
self.addObserver(k, function(){ | |
Ember.run.once(self, 'somethingChanged'); | |
}); | |
Ember.defineProperty(this, k, null, v); | |
this.notifyPropertyChange(k); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var WatchedObject = Ember.Object.extend({ | |
"*": null, | |
setUnknownProperty: function(k,v){ | |
var self = this; | |
self.addObserver(k, function(){ | |
Ember.run.once(self, 'somethingChanged'); | |
}); | |
Ember.defineProperty(this, k, null, v); | |
this.notifyPropertyChange(k); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle', | |
a: Ember.computed('b', { | |
get: function() { | |
return this.get('b') *2; | |
}, | |
set: function(k, v){ | |
this.set('b', v/2); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
let i=0; | |
export default Ember.Controller.extend({ | |
arr: [], | |
counter: (function(){ | |
return this.get('arr.firstObject'); | |
}).property('arr'), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
let i=0; | |
export default Ember.Controller.extend({ | |
arr: [], | |
counter: (function(){ | |
return this.get('arr.firstObject'); | |
}).property('arr.@each.x'), |
OlderNewer