Skip to content

Instantly share code, notes, and snippets.

@hungryblank
Created October 25, 2010 09:51
Show Gist options
  • Save hungryblank/644699 to your computer and use it in GitHub Desktop.
Save hungryblank/644699 to your computer and use it in GitHub Desktop.
CHARS = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
SIZE = CHARS.size
def short(number)
chars = []
while number != 0 do
number, mod = number.divmod(SIZE)
chars.unshift(CHARS[mod])
end
chars.pack('c' * chars.size)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment