Skip to content

Instantly share code, notes, and snippets.

@Arcath
Arcath / gist:481321
Created July 19, 2010 12:19
gravatar avatar url generating helper method, simply pass an email to it
def gravatar_url(email,options = {})
require 'digest/md5'
hash = Digest::MD5.hexdigest(email)
url = "http://www.gravatar.com/avatar/#{hash}"
options.each do |option|
option == options.first ? url+="?" : url+="&"
key = option[0].to_s
value = option[1].to_s
url+=key + "=" + value
end
@Arcath
Arcath / player.rb
Created June 14, 2010 20:41
My Ruby-Warrior player.rb
class Player
Directions = [:left, :right, :forward, :backward]
FullHealth = 20
def full_health?
@warrior.health == FullHealth
end
def whats_out_there?