Skip to content

Instantly share code, notes, and snippets.

@mason-stewart
Created May 7, 2011 22:33
Show Gist options
  • Save mason-stewart/960916 to your computer and use it in GitHub Desktop.
Save mason-stewart/960916 to your computer and use it in GitHub Desktop.
How many of them there Micro libraries are there?!
//Run this in the console at http://microjs.com to see how much it would weigh if you used 'em all! ;D
var theSizes = document.getElementsByTagName("div");
var total = 0;
var incorrectClass = 0;
var i = theSizes.length;
var current;
while (i--) {
if ( theSizes[i].className == "size" ) {
current = theSizes[i].innerHTML;
total += parseFloat(current.substring(0, current.length -1));
} else {
incorrectClass ++;
}
}
console.log(theSizes.length - incorrectClass + " micro frameworks & libraries weighing an underwhelming total of " + total.toFixed(1) + "k!")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment