0.1 + 0.2 // 0.30000000000000004
sumFloats([0.1, 0.2]) // 0.3
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 DeepLinkState = { | |
linkState: function(path) { | |
function setPath(obj, path, value) { | |
var leaf = resolvePath(obj, path); | |
leaf.obj[leaf.name] = value; | |
} | |
function getPath(obj, path) { | |
var leaf = resolvePath(obj, path); | |
return leaf.obj[leaf.name]; |

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
callWithNamed({one: 1, two: 2, three: 3}, function(three, one, two) { | |
console.log(one, two, three); | |
}); | |
function callWithNamed(dict, fn, context) { | |
var newArgs = []; | |
var parsedArgs = parseArgs(fn); | |
for (var i = 0; i < parsedArgs.length; i++) { | |
var name = parsedArgs[i]; |
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 style = document.createElement('style') | |
var iframe = document.createElement('iframe') | |
document.body.appendChild(iframe) | |
iframe.contentDocument.documentElement.appendChild(style) | |
iframe.style.display = 'none' | |
style.textContent = 'a {color: red}' | |
style.sheet // CSSStyleSheet | |
style.sheet.cssRules[0].cssText // 'a { color: red; }' | |
style.sheet.cssRules[0].selectorText // 'a' |
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
attachPair(document.getElementById('a'), document.getElementById('b'), createPolygon()); | |
attachPair(document.getElementById('c'), document.getElementById('d'), createPolygon()); | |
attachPair(document.getElementById('e'), document.getElementById('f'), createPolygon()); | |
function attachPair(a, b) { | |
var polygon = createPolygon(); | |
draggable(a, { | |
onMove: function(e) { | |
update(a, b, polygon); | |
} |
Serve static files in a current directory and create $current_dir.dev
host name.
~/Sites/usercss.ru ➤ pow
open http://usercss.ru.dev/
~/Sites/n12v.com/static ➤ pow n12v
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
function serve | |
set NAME (basename $PWD) | |
mkdir -p "$HOME/.pow/$NAME" | |
ln -s $PWD "$HOME/.pow/$NAME/public" | |
open "http://$NAME.dev" | |
end |
stopBefore(document, 'getElementById')
stopBefore('document.getElementById') // the same as the previous
stopBefore(Element.prototype, 'removeChild')
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
<script src="devtools.js"></script> |