Skip to content

Instantly share code, notes, and snippets.

View kirstein's full-sized avatar

Mikk Kirstein kirstein

View GitHub Profile
@aeharding
aeharding / timeoutSort.coffee
Last active August 29, 2015 14:05
Sort an array of positive integers using timeouts. *genius*
# Only works with positive numbers #dealwithit
timeoutSort = (arr, cb) ->
ret = []
longest = 0
for t in arr then do ->
longest = t if t > longest
tmp = t
setTimeout ->
ret.push tmp
, t