Skip to content

Instantly share code, notes, and snippets.

View vsaurabh04's full-sized avatar
🤠
Learning

Saurabh Vikram vsaurabh04

🤠
Learning
  • Kanpur
View GitHub Profile
@solenoid
solenoid / gist:1372386
Created November 17, 2011 04:49
javascript ObjectId generator
var mongoObjectId = function () {
var timestamp = (new Date().getTime() / 1000 | 0).toString(16);
return timestamp + 'xxxxxxxxxxxxxxxx'.replace(/[x]/g, function() {
return (Math.random() * 16 | 0).toString(16);
}).toLowerCase();
};