Skip to content

Instantly share code, notes, and snippets.

@astropanic
Created November 3, 2014 10:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save astropanic/4f583740f93465fbd2bc to your computer and use it in GitHub Desktop.
Save astropanic/4f583740f93465fbd2bc to your computer and use it in GitHub Desktop.
Ruby is a beautiful language
return (1<<31) - (name.downcase.each_byte.each_with_index.to_a.inject(0.0) {|s,(v,i)| s+=(v.to_f/[((2**8)*i), 1.0].max);s} * (2**23)).to_i
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment