Skip to content

Instantly share code, notes, and snippets.

/_.md Secret

Created August 15, 2011 12:35
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 anonymous/887fd5d62beaea30a25a to your computer and use it in GitHub Desktop.
Save anonymous/887fd5d62beaea30a25a to your computer and use it in GitHub Desktop.

desired

["a", "s", "d", "f", "g", "h", "j", "k", "l", ";", "aa", "as", "ad", "af", "ag", "ah", "aj", "ak", "af"..."sa", "ss", "sd"...]

actual

["a", "s", "d", "f", "g", "h", "j", "k", "l", ";", "aa", "as", "ad", "af", "ag", "ah", "aj", "ak", undefined]

HINTS = ["a", "s", "d", "f", "g", "h", "j", "k", "l", ";"]
$(document).bind "keydown", "f", ->
anchors = 19 # will change to $("a").length
allHints = ->
for i in [0...anchors]
do (i) ->
if i > 9
(for y in [0...i % 9]
do (y) ->
#changing this to HINTS[Math.round(i / 10)] as it should be produces weird results
HINTS[y] + HINTS[i % 9 - 1])[0]
else
HINTS[i]
console.log allHints anchors
var HINTS;
HINTS = ["a", "s", "d", "f", "g", "h", "j", "k", "l", ";"];
$(document).bind("keydown", "f", function() {
var allHints, anchors;
anchors = 19;
allHints = function() {
var i, _results;
_results = [];
for (i = 0; 0 <= anchors ? i < anchors : i > anchors; 0 <= anchors ? i++ : i--) {
_results.push((function(i) {
var y;
if (i > 9) {
return ((function() {
var _ref, _results2;
_results2 = [];
for (y = 0, _ref = i % 9; 0 <= _ref ? y < _ref : y > _ref; 0 <= _ref ? y++ : y--) {
_results2.push((function(y) {
return HINTS[y] + HINTS[i % 9 - 1];
})(y));
}
return _results2;
})())[0];
} else {
return HINTS[i];
}
})(i));
}
return _results;
};
return console.log(allHints(anchors));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment