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
// created by greg reimer ("gregreimer" at gmail) http://obadger.com/ | |
function createHistogram(rFunc) { | |
var arr = []; | |
var size = 30; | |
for (var i=0; i<size; i++){ | |
arr[i] = 0; | |
} | |
for (var i=0; i<1000000; i++){ | |
arr[Math.floor(rFunc() * size)]++; |
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
/** | |
Extend Backbone.SoftModel and then bind to the 'soft:change' event. | |
It will only fire once given a sequence of rapid-fire changes. | |
This avoids for example having multiple redundant renders, | |
which can be a performance killer. That way you don't have to | |
splatter your code with speculative {silent:true}s. | |
Warning! | |
This code is untested. This is just exploring an idea. | |
*/ |
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
/** | |
tree.js - nice ascii-art DOM trees | |
usage: tree(element[, options]); | |
example: | |
var s = tree(document.body,{ | |
serialize: function(element){...}, // return a string representation such as "div#foo.bar" | |
filter: function(element){...} // return false for any nodes to not include in tree | |
}); | |
console.log(s); | |
*/ |
NewerOlder