Last active
June 26, 2016 21:27
-
-
Save rafops/d4ea9fdc5fe15f9256c1748f7cdd8b92 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def uuid_to_urlsafe_base64(uuid) | |
s = [[uuid.delete('-')].pack('H*')].pack('m') | |
s.delete!("\n") | |
s.tr!('+/', '-_') | |
s.delete!('=') | |
s | |
end | |
uuid_to_urlsafe_base64(SecureRandom.uuid) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment