Created
December 30, 2015 16:27
-
-
Save jerodsanto/90c03f52fb0691356a24 to your computer and use it in GitHub Desktop.
Elixir's pipeline operator makes FP joyous. Here it is transforming an email address for Gravatar'ing
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 gravatar_url(email, size) do | |
hash = email | |
|> String.strip | |
|> String.downcase | |
|> :erlang.md5 | |
|> Base.encode16(case: :lower) | |
"https://secure.gravatar.com/avatar/#{hash}.jpg?s=#{size}&d=mm" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment