Skip to content

Instantly share code, notes, and snippets.

View raphaelmolesim's full-sized avatar

Raphael Molesim raphaelmolesim

View GitHub Profile
@raphaelmolesim
raphaelmolesim / gist:2669316
Created May 12, 2012 21:54
Também levei um susto
require 'nokogiri'
# tá aqui o orçamento executado de 2011 da camara de sp
#http://www.camara.sp.gov.br/index.php?option=com_wrapper&view=wrapper&Itemid=219
xml = File.read "COMPLETO.xml"
p = lambda { |i| i.inner_text.gsub(",", ".").to_f }
def m fl
"%1.2f" % fl
end
doc = Nokogiri::XML(xml)
fornecedores = doc.xpath("//fornecedor").collect { |i| i.attribute("nome").value }.uniq
class StonePaperScissor
@@rules = Hash.new(:draw).merge({
[:stone, :scissor] => :left_wins,
[:stone, :paper] => :right_wins,
[:paper, :scissor] => :right_wins,
[:paper, :stone] => :left_wins,
[:scissor, :stone] => :right_wins,