Last active
August 29, 2015 14:00
-
-
Save frequent/11402276 to your computer and use it in GitHub Desktop.
uuid this
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
util.uuid = function () { | |
var snap, snip; | |
snap = "-"; | |
snip = function (str, end) { | |
return (Math.random().toString(16) + str).slice(2, end); | |
}; | |
return snip("00000000", 10) + snap + | |
snip("0000", 6) + snap + | |
snip("0000", 6) + snap + | |
snip("0000", 6) + snap + | |
snip("000000", 8) + | |
snip("000000", 8); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment