Last active
December 21, 2015 17:28
-
-
Save mindaslab/6340267 to your computer and use it in GitHub Desktop.
Simple UUID examples
This file contains hidden or 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
require 'rubygems' | |
require 'simple_uuid' | |
uuid = SimpleUUID::UUID.new | |
uuid.to_guid # actually this is what I have stored in my database | |
puts Time.at(SimpleUUID::UUID.new(uuid.to_guid).seconds) |
This file contains hidden or 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
require 'rubygems' | |
require 'simple_uuid' | |
uuid = SimpleUUID::UUID.new | |
bytes = uuid.bytes | |
uuid1 = SimpleUUID::UUID.new bytes | |
p bytes.class | |
p uuid == uuid1 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment