Skip to content

Instantly share code, notes, and snippets.

@jonsage
Last active September 23, 2020 12:59
Show Gist options
  • Save jonsage/12ea96dfaac066b039c18ebba1860fb3 to your computer and use it in GitHub Desktop.
Save jonsage/12ea96dfaac066b039c18ebba1860fb3 to your computer and use it in GitHub Desktop.
Short ID

Eight character random ids

JS

Math.round(Math.random()*(36**8)).toString(36)

Ruby

rand(36**8).to_s(36)

Jekyll/Liquid

{{ 'abcdefghijklmnopqrstuvwxyz1234567890' | split: '' | sample: 8 }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment