Skip to content

Instantly share code, notes, and snippets.

@camerond
Forked from shaneriley/gist:1854893
Created April 26, 2012 20:33
Show Gist options
  • Save camerond/2502862 to your computer and use it in GitHub Desktop.
Save camerond/2502862 to your computer and use it in GitHub Desktop.
WTF CoffeeScript (refactor)
# Refactor of shane_riley's issue
$("dl.card :text").change ->
$e = $(@)
val = $e.val()
odd = []
even = []
for v, i in val.split("")
if !(i % 2) then odd.push(v)
else
e = ("" + (v * 2)).split("")
even.push(+e[0] + +e[1])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment