Last active
May 6, 2019 01:38
-
-
Save AquaGeek/4566236 to your computer and use it in GitHub Desktop.
Ruby
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
| # Cleaner invocation of presenter on collection | |
| current_user.tickets.map(&TicketPresenter.method(:new)) |
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
| Digest::MD5.hexdigest("#{SecureRandom.hex(10)}-#{DateTime.now.to_s}") # Doesn't SecureRandom already seed with time? | |
| # http://blog.logeek.fr/2009/7/2/creating-small-unique-tokens-in-ruby | |
| rand(36**8).to_s(36) | |
| # From Ryan Bates (http://railscasts.com/episodes/124-beta-invitations) | |
| Digest::SHA1.hexdigest([Time.now, rand].join) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment