Created
July 20, 2010 20:03
-
-
Save amiel/483480 to your computer and use it in GitHub Desktop.
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
if (!$.isFunction(Array.prototype.rand)) { | |
Array.prototype.rand = function() { | |
function rand(n) { return Math.floor(Math.random() * n); } | |
return this[rand(this.length)]; | |
}; | |
} | |
$.konamiRand = (function() { | |
var fns = [], konami = function() { fns.rand()(); }; | |
$.konami(konami); | |
return function(fn) { | |
fns.push(fn); | |
}; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment