public
Created

CoffeeScript implementation of http://stackoverflow.com/a/16693578/697190

  • Download Gist
gistfile1.coffee
CoffeeScript
1 2 3 4 5 6
generateUniqueID = () ->
_p8 = (s) ->
p = (Math.random().toString(16)+"000000000").substr(2,8)
if s then "-" + p.substr(0,4) + "-" + p.substr(4,4) else p
 
_p8() + _p8(true) + _p8(true) + _p8()

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.