Skip to content

Instantly share code, notes, and snippets.

View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
counter: 0,
callCount: 0,
ocallCount: 0,
setCounter: Ember.on('init', function(){
View components.graph-creator.js
import Ember from 'ember';
import GraphCreator from '../lib/GraphCreator';
const style = `
body{
margin: 0;
padding: 0;
overflow:hidden;
}
View controllers.application.js
import Ember from 'ember';
var ComputedProto = Object.getPrototypeOf(Ember.computed(function(){}));
var isComputed = function(obj){
return typeof(obj) === 'object' && ComputedProto.isPrototypeOf(obj);
}
var ObserverProto = Object.getPrototypeOf(Ember.observer(function(){}));
var isObserver = function(obj){
return typeof(obj) === 'function' && ObserverProto.isPrototypeOf(obj);
}
@ofersadgat
ofersadgat / controllers.application.js
Last active Dec 9, 2016
Property compute is expensive
View controllers.application.js
import Ember from 'ember';
var fib = function(n){
switch(n){
case 0: return 0;
case 1: return 1;
default: return fib(n-1) + fib(n-2);
}
};
@ofersadgat
ofersadgat / controllers.application.js
Last active Dec 8, 2016
Property compute is expensive - with shortcut
View controllers.application.js
import Ember from 'ember';
var fib = function(n){
switch(n){
case 0: return 0;
case 1: return 1;
default: return fib(n-1) + fib(n-2);
}
};