Skip to content

Instantly share code, notes, and snippets.

@shawndumas
Last active May 4, 2022 15:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save shawndumas/5c5b4b3a0b26802c0fee to your computer and use it in GitHub Desktop.
Save shawndumas/5c5b4b3a0b26802c0fee to your computer and use it in GitHub Desktop.
GUID
var guid = function fn (n) {
return n ?
(n ^ Math.random() * 16 >> n/4).toString(16) :
('10000000-1000-4000-8000-100000000000'.replace(/[018]/g, fn));
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment