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 shuffle(array) { return array.sort(function(){ return .5 - Math.random(); }); } |
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
$.fn.zap = function () { return this.each(function(){ $(this.childNodes).insertBefore(this); }).remove(); }; |
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
.sitemap ul { margin: 0.5em 0 0.5em 2em; } | |
.sitemap li { margin-bottom: 0.5em; } |
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
// Requires node v0.1.100 or a browser with console | |
function newShape(x, y) { | |
return { | |
toString: function () { | |
return 'Shape at ' + x + ', ' + y; | |
} | |
}; | |
} |
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 visit_nodes_iterative(node) { | |
node = node || document; | |
do | |
{ | |
/* Do something with node here */ | |
node = node.firstChild || node.nextSibling || function() { | |
while ((node = node.parentNode) && !node.nextSibling); | |
return node ? node.nextSibling : null; |
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
while (el.firstChild) | |
el.removeChild(el.firstChild); |
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
getLayout: function(el) { | |
var props = { width: 'Width', height: 'Height', left: 'Left', top: 'Top' }; | |
for (var p in props) | |
props[p] = el['offset' + props[p]]; | |
while (el = el.offsetParent) { | |
props.left += el.offsetLeft; | |
props.top += el.offsetTop; | |
} |
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.getElementById('c1').classList.toggle('blinkon'); |