There are a lot of Konami Code easter eggs out there and also a lot of guides on how to implement your own. Most of these guides have one thing in common; they are using overly verbose code for something you could fit inside a Twitter tweet.
The last week I’ve seen a dozens of blog posts related to Facebook’s, Jquery’s and many others hidden implementation of the ‘Konami code’ and how to implement one yourself.
One of the things I noticed was that people tend to write very verbose code, meaning, they tend to write a lot more code then they need too. Take a look at Abhi’s 30-rows implementation or Trevor’s Cheat Code Jquery plugin(!).
There are numbers of valid explanations to why people write verbose code; to be overly clear for educational purposes is one. But if you do that, I think you should also teach people that they shouldn’t make a habit out of it, especially when it comes to something so small that it fits inside a Twitter tweet.
// Tweetable Konami code
var k=[];addEventListener("keyup",function(e){ k.push(e.keyCode);if(k.toString().indexOf("38,38,40,40,37,39,37,39,66,65")>=0)cheat()},true);
The code above will fire the function cheat() when you enter the Konami Code (up,up,down,down,left,right,left,right,b,a). The code might be a bit too concies, but I was mainly trying to make a point.
Haven’t seen the Konami Code in action?
Go to www.facebook.com and login. Click once anywhere on your home page and type the following sequence using your keyboard: Up, Up, Down, Down, Left, Right, Left, Right, B, A, Enter Key. Click again or scroll the page.
Comments
Make a comment
Projects
- Accordion (jQuery)
- Airport (jQuery)
- Chat
- Defaultvalue (jQuery)
- Elastic (jQuery)
- Highlight (jQuery)
- Keycan
- Lazy (jQuery)
- Limit (jQuery)
- Password Strength (jQuery)
- Show Password (jQuery)
- Tabify (jQuery)
- Valid8 (jQuery)
Latest posts
- July 8th, 2009 Why are we typing passwords twice?
- July 5th, 2009 Don’t stop password masking; let the user decide
- June 1st, 2009 You can’t validate email addresses with regular expressions
- May 20th, 2009 Konami Code: Why so verbose, when you can make it in 140 characters?
- May 18th, 2009 Let your users know if Firebug slows down your web page.
Hi Jan,
Nice tweetable code.
However my intention was never to send it over as a tweet ;) As you said, a bit longer because it should be self explainatory :D
-Abhi
I disagree, you should be in the habit of writing verbose code… cryptic, compressed, unreadable code is never a good idea!
Cute, though!
Gives an error in IE6
fapEY8 nnvajmkezakc, [url=http://htdzlukrnfam.com/]htdzlukrnfam[/url], [link=http://pagtwwcotmdd.com/]pagtwwcotmdd[/link], http://rwgtgfcgetdx.com/