Skip to content

Instantly share code, notes, and snippets.

@bsa7
Last active August 29, 2015 14:00
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 bsa7/d15fff7d5d42baa50875 to your computer and use it in GitHub Desktop.
Save bsa7/d15fff7d5d42baa50875 to your computer and use it in GitHub Desktop.
coffeescript for
# iterate 0 to n
for e in [0..n]
console.log e
# iterate in array with element (itm) and index (i)
sort_weigth = (arr) ->
w = 0
for itm, i in arr
w += (itm == 0 ? 0 : 1) * Math.pow(10, arr.length - i)
w
# iterate in array with element (itm)
res = ""
for e in arr
res += e.toString()
#iterate each jQuery object
$("li").each (index) ->
console.log index + ": " + $(this).text()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment