Skip to content

Instantly share code, notes, and snippets.

@hjst
Created August 10, 2010 08:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hjst/516936 to your computer and use it in GitHub Desktop.
Save hjst/516936 to your computer and use it in GitHub Desktop.
if ( window.addEventListener ) {
var pressed_keys = [];
var cheat = "38,38,40,40,37,39,37,39,66,65";
window.addEventListener("keydown", function(e){
pressed_keys.push( e.keyCode );
if ( pressed_keys.toString().indexOf( cheat ) >= 0 ) {
// User entered the cheat - do something HILARIOUS
pressed_keys = []; // wipe the keys
}
}, true);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment