Skip to content

Instantly share code, notes, and snippets.

@amiel
Created March 30, 2010 17:21
Show Gist options
  • Save amiel/349323 to your computer and use it in GitHub Desktop.
Save amiel/349323 to your computer and use it in GitHub Desktop.
if (!$.isFunction(Array.prototype.rand)) {
Array.prototype.rand = function() {
function rand(n) { return Math.floor(Math.random() * n); }
return this[rand(this.length)];
};
}
$.konamiAdrian = (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