This file contains hidden or 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
| function myPromise(fn){ | |
| let done = false; | |
| let next = []; | |
| fn(() => { | |
| done = true; | |
| while (next.length > 0) next.pop()(); | |
| }); | |
| return { | |
| then: fn => { |
This file contains hidden or 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
| //Proposal for temporary scope variables | |
| let result = something.crazy.long.bar ? something.crazy.long.bar() : something.crazy.long.other(); | |
| //with() - Not 'strict' compliant | |
| with (something.crazy.long){ | |
| result = bar ? bar() : other(); | |
| } | |
| //fat arrow function |
This file contains hidden or 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
| //Transpiled from Babel | |
| "use strict"; | |
| function MRDbg() { | |
| for (var _len = arguments.length, txt = Array(_len), _key = 0; _key < _len; _key++) { | |
| txt[_key] = arguments[_key]; | |
| } | |
| return function (prev, cur, i, arr) { | |
| if (i === 1) { |
This file contains hidden or 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
| //Use ES6 modules for your controllers in SailsJS | |
| //requires https://github.com/artificialio/sails-hook-babel | |
| export default { | |
| controllerAction1(req, res) { | |
| //... | |
| }, | |
| controllerAction2(req, res) { | |
| //... |
This file contains hidden or 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
| //Copied from http://stackoverflow.com/q/4899799/119909 | |
| function pixel(x,y){ | |
| d[0] = 255;//r | |
| d[1] = 0;//g | |
| d[2] = 0;//b | |
| d[3] = 255;//a | |
| ctx.putImageData( id, x, y ); | |
| } | |
| var ctx = document.getElementById('c').getContext('2d'); | |
| var id = ctx.createImageData(1,1); |
NewerOlder