Skip to content

Instantly share code, notes, and snippets.

@henrik
Created November 21, 2008 12: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 henrik/27428 to your computer and use it in GitHub Desktop.
Save henrik/27428 to your computer and use it in GitHub Desktop.
require 'net/http'
require 'digest/md5'
# Is there a Gravatar for this email?
def gravatar?(email)
hash = Digest::MD5.hexdigest(email.to_s.downcase)
response = Net::HTTP.new('www.gravatar.com', 80).request_head("/avatar/#{hash}?size=1&default=.")
response.code != '302'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment