Skip to content

Instantly share code, notes, and snippets.

@frequent
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 frequent/11402276 to your computer and use it in GitHub Desktop.
Save frequent/11402276 to your computer and use it in GitHub Desktop.
uuid this
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