Skip to content

Instantly share code, notes, and snippets.

@patrickfox
Created September 9, 2014 14:35
Show Gist options
  • Save patrickfox/7f6946c55e410d502d6b to your computer and use it in GitHub Desktop.
Save patrickfox/7f6946c55e410d502d6b to your computer and use it in GitHub Desktop.
$.get_guid() generates a globally unique ID(GUID). The get_new flag returns a new id if true, or, by default, returns the previous id.
$.get_guid = function(get_new) {
get_new = get_new || false;
if ($.guid === null) {
$.guid = 0;
}
if (get_new) {
$.guid++;
}
return $.guid;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment