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
// Paste this function to your browser’s JavaScript console, | |
// and then run it, passing in a CSS selector, eg: | |
// > pseudolocalize('body') | |
var pseudolocalize = function pseudolocalize(arg){ | |
if(typeof arg === 'string'){ | |
var elements = document.querySelectorAll(arg); | |
for(var i=0, len=elements.length; i<len; i++){ | |
pseudolocalize(elements[i]); | |
} |
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 onChild(child, event, callback) { | |
child.on('message', (function (args) { | |
if (args[0] === event) { | |
callback.apply(null, Array.prototype.slice.call(args, 1)); | |
} | |
})); | |
} | |
function emitChild(/* child, event, [arg1], [arg2], [...] */) { | |
var args = Array.prototype.slice.call(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
// SYNCHRONOUS MAP | |
function smap(src, fn) { | |
if (src.length == 0) { | |
return []; | |
} else { | |
return [fn(src[0])].concat(smap(src.slice(1), fn)); | |
} | |
} |