Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

Guid generator in Javascript.

View gist:2295777
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
(function(){
if(!window.String.UUID){
var matcher = /[xy]/g;
var replacer = function(c) {
var r = Math.random()*16|0;
var v = c == 'x' ? r : (r&0x3|0x8);
return v.toString(16);
};
//maybe shouldn't be modifying the global variable, but seems like the best place to put this.
window.String.UUID = function(){
//see http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript for more details.
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(matcher, replacer);
};
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.