Skip to content

Instantly share code, notes, and snippets.

@smathy
Created March 13, 2011 08:24
Show Gist options
  • Save smathy/867969 to your computer and use it in GitHub Desktop.
Save smathy/867969 to your computer and use it in GitHub Desktop.
def guid
secs, microsecs = ("%.6f" % Time.now.to_f).split('.')
sprintf( "%05x%s-%s-%s-%s-%08x%s", microsecs.to_i, rand_hex(3), rand_hex(4), rand_hex(4), rand_hex(4), secs.to_i, rand_hex(4))
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment