Skip to content

Instantly share code, notes, and snippets.

@AbeEstrada
Last active August 29, 2015 14:15
Show Gist options
  • Save AbeEstrada/b7405447f6f2137c5269 to your computer and use it in GitHub Desktop.
Save AbeEstrada/b7405447f6f2137c5269 to your computer and use it in GitHub Desktop.
Trello Node.js Developer Challenge - https://trello.com/jobs/developer
letters = "acdegilmnoprstuw"
hash = (s) ->
h = 7
for l in s
h = (h * 37 + letters.indexOf(l))
h
rhash = (h) ->
return rhash((h - (h % 37)) / 37) + letters[h % 37] if h > letters.length
return ""
s = "leepadg"
console.log hash(s)
console.log rhash(hash(s))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment