Skip to content

Instantly share code, notes, and snippets.

@courajs
courajs / helpers-radio-button.js
Created June 3, 2014 17:01
Cooler magic binding radio buttons
import RadioView from '../views/radio';
export default Ember.Handlebars.makeViewHelper(RadioView);
@courajs
courajs / helpers-radio-button.js
Created June 3, 2014 18:04
Simpler explicit name radio buttons
import RadioView from '../views/radio';
export default Ember.Handlebars.makeViewHelper(RadioView);
@courajs
courajs / profileSync
Created November 4, 2015 14:33
Profile a synchronous function
window.profileSync = function profileSync(name, f){
return function(){
console.log("starting "+name)
start_time = new Date()
f.apply(this, arguments)
end_time = new Date()
time = (end_time - start_time) / 1000
console.log("finished "+name+" in "+time+" seconds.")
}
}
@courajs
courajs / controller.js
Last active November 4, 2015 20:45
app/computed-property-macros/hash.js
import Ember from 'ember';
import hash from 'app/computed-property-macros/hash';
const {
Component
} = Ember;
export default Component.extend({
order: hash('price', 'count')
});
@courajs
courajs / application.controller.js
Created February 3, 2016 18:41
sendClosureAction
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle',
actions: {
hello() {
alert('world');
}
}
});

Viz that feels right

Abstract

The abstract is the 300 character elevator pitch for this talk

Data visualization is hard. Let's say a designer hands you a single example, with simple data. How do you build something that will handle the complexity of real-world data? Find the rules and constraints

@courajs
courajs / application.controller.js
Last active May 24, 2018 17:29
Component Subexpressions one-way by default?
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
val1: 8,
val2: 8
});
@courajs
courajs / application.controller.js
Created March 24, 2016 15:38
Using computed.or incorrectly
import Ember from 'ember';
const {
computed: { or }
} = Ember;
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
thing: or('someKey', 'this is wrong')
});
/*
It is not the critic who counts; not the man who points out how the
strong man stumbles, or where the doer of deeds could have done them
better. The credit belongs to the man who is actually in the arena,
whose face is marred by dust and sweat and blood; who strives valiantly;
who errs, who comes short again and again, because there is no effort
without error and shortcoming; but who does actually strive to do the
deeds; who knows great enthusiasms, the great devotions; who spends
himself in a worthy cause; who at the best knows in the end the triumph
@courajs
courajs / bodyString.js
Created September 12, 2016 18:24
Some evil...
Function.prototype.bodyString = function bodyString(){
var s = this.toString();
return s.substring(s.indexOf('\n'), s.lastIndexOf('\n'));
}
console.log(function(){/*
hey
indented
\n\\\///* $pecial ch&rs
*/}.bodyString());