Skip to content

Instantly share code, notes, and snippets.

View ramyhhh's full-sized avatar
🏠
Working from home

Rami Hanano ramyhhh

🏠
Working from home
View GitHub Profile
@ramyhhh
ramyhhh / ObjectIdGenerator
Created September 24, 2018 17:39
Mongo ObjectId generator typescript
class ObjectIdGenerator {
static generate(): string {
let result = Math.round(new Date().getTime() / 1000).toString(16);
for (let i = 0; i < 16; i++) {
result += Math.round(Math.random() * 16).toString(16);
}
return result.substr(0,24);
}
}