-
Data Down / Actions Up
- http://emberjs.jsbin.com/nayaho/edit?html,js - Interdependent select boxes. No observers.
- http://ember-twiddle.com/2d7246875098d0dbb4a4 - One Way Input
-
Plain JSBin's
-
Ember Version Base JSBin's
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
[0, ['a', 'b', 'c'], 2, 'd', 4, 5, 'f', 7, ['g', 'h'], 9].reduce(function rec (prev, curr) { | |
if (/array/i.test(curr.constructor)) { | |
return curr.reduce(rec, prev); | |
} else if (/string/i.test(curr.constructor)) { | |
prev.push(curr); | |
} | |
return prev; | |
}, []); |
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 guid = function fn (n) { | |
return n ? | |
(n ^ Math.random() * 16 >> n/4).toString(16) : | |
('10000000-1000-4000-8000-100000000000'.replace(/[018]/g, fn)); | |
}; |
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
const logicGates = { | |
nand (a, b) { return !(a && b); }, | |
not (a) { return this.nand (a, a); }, | |
and (a, b) { return this.not (this.nand (a, b)); }, | |
or (a, b) { return this.nand (this.not (a), this.not(b)); }, | |
nor (a, b) { return this.not (this.or (a, b)); }, | |
xor (a, b) { return this.and (this.nand (a, b), this.or(a, b)); }, | |
xnor (a, b) { return this.not (this.xor (a, b)); } | |
}; |
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
/* will return null::json on empty resultset */ | |
SELECT array_to_json(array_agg(row_to_json(t))) FROM t; | |
/* | |
will return '[]' on empty resultset, | |
null::json seems to be managed the same way than sql NULL by COALESCE() | |
*/ | |
SELECT COALESCE(array_to_json(array_agg(row_to_json(t))), '[]') FROM t; | |