Skip to content

Instantly share code, notes, and snippets.

@ebeloded
Created May 25, 2023 01:34
Show Gist options
  • Save ebeloded/ecce772c1acab6f5c213e9005355c348 to your computer and use it in GitHub Desktop.
Save ebeloded/ecce772c1acab6f5c213e9005355c348 to your computer and use it in GitHub Desktop.
stringId
function getStringId(index) {
const symbols =
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
let num = index
let id = ''
do {
id = symbols[num % 62] + id
num = Math.floor(num / 62)
} while (num > 0)
return id
}
const x = Math.floor((Date.now() - Number(new Date(2023, 4))) / 1000) /*?*/
getStringId(x) /*?*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment