Skip to content

Instantly share code, notes, and snippets.

@jason-s13r
Last active August 29, 2015 14:17
Show Gist options
  • Save jason-s13r/0199179c7f57ea7a379a to your computer and use it in GitHub Desktop.
Save jason-s13r/0199179c7f57ea7a379a to your computer and use it in GitHub Desktop.
konami(function(){
console.log('KONAMI!!!');
});
function konami(fn, match) {
var konamiCode = '3838404037393739666513';
var sequence = '';
match = match || konamiCode;
window.addEventListener('keyup', function(event){
sequence += event.keyCode;
if (match === sequence) {
fn();
}
if (match.indexOf(sequence) === -1) {
sequence = '';
}
}, false);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment