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
Iterators = (function() { | |
var each, map, filter, reduce, toArray, toObject; | |
function _map(iter, f) { | |
return { | |
hasNext: iter.hasNext, | |
next: function() { return f(iter.next()); } | |
}; | |
} | |
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 throttle(fn, ms) { | |
var last = (new Date()).getTime(); | |
return (function() { | |
var now = (new Date()).getTime(); | |
if (now - last > ms) { | |
last = now; | |
fn.apply(null, arguments); | |
} | |
}); | |
} |
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
// Observable is an Union Type, with the following variants | |
const Empty = () => ['EMPTY'] | |
const Cons = (head, tail) => ['CONS', head, tail] | |
const Future = promise => ['FUTURE', promise] | |
// race between 2 promises; each promise will resolve to a lazy value | |
const lazyRace = (p1, p2) => Promise.race([p1,p2]).then(lazy => lazy()) | |
// function composition | |
const compose = (...fns) => (arg) => fns.reduceRight((res, f) => f(res), arg) |
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
const flatten = xs => { | |
let next = (acc, xs) => xs.reduce((x, y) => Array.isArray(y) | |
? next(x, y) | |
: (x[x.length] = y, x) | |
, acc); | |
return next([], xs); | |
} |
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
let obj = { | |
id: 14521, | |
name: 'Annamalai', | |
notify:function(){ | |
console.log(`Hallo ${this.name} ! Your ID is ${this.id}`) | |
} | |
} | |
//obj.notify(); |
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
ffmpeg -framerate 25 -f image2 -pattern_type glob -i "*.JPG" -s:v 1920x1440 -c:v libx264 -r 25 ../timelapse.mp4 |
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
import Ember from 'ember'; | |
export default Ember.Component.extend({ | |
classNames:['ui-input'], | |
classNameBindings:[ | |
'isFilled:has-value' | |
], | |
currentValue: '', | |
isFilled: Ember.computed.notEmpty('currentValue'), | |
}); |
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
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle', | |
checked:[], | |
grp: [ | |
{ d: 'a' , v: false }, | |
{ d: 'b' , v: false }, | |
{ d: 'c' , v: false }, | |
{ d: 'd' , v: false } |
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
/** | |
* Size of one chunk when requesting with Range | |
* @type {Number} | |
* @private | |
*/ | |
const CHUNK_SIZE = 204800; | |
/** | |
* Concat two ArrayBuffers | |
* @param {ArrayBuffer} ab1 |
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
[...document.styleSheets[0].rules].filter(sel => sel.cssText.startsWith('@font-face') ).map(sel =>sel.style.fontFamily) |