Skip to content

Instantly share code, notes, and snippets.

@yutin1987
Created December 19, 2013 17:42
Show Gist options
  • Save yutin1987/8043252 to your computer and use it in GitHub Desktop.
Save yutin1987/8043252 to your computer and use it in GitHub Desktop.
A Pen by Justin Liu.
<html>
<head>
</head>
<body>
</body>
</html>
$ () ->
keys = [38,38,40,40,37,39,37,39,66,65]
key_str =
38: '↑'
40: '↓'
37: '←'
39: '→'
65: 'A'
66: 'B'
key_index = 0
tip = ''
$('body').keydown(e) ->
if keys[key_index] is parseInt(e.keyCode)
tip = tip+key_str[keys[key_index]]
key_index++
else
tip = ''
key_index = 0
$('body').text tip
if key_index >= keys.length
$('body').text 'PASS'
key_index = 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment