/ Published in: Ruby

Command line currency convertor, just copy and paste. I named mine 'coin'. Make sure you have Ruby, Rubygems and Hpricot (gem install hpricot).
e.g.
~$ coin 100 eur usd
158.3300
Uses the site xurrency.com.
e.g.
~$ coin 100 eur usd
158.3300
Uses the site xurrency.com.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
#!/usr/bin/env ruby -w unless ARGV.length == 3 puts "\tUsage :\n\t\t#{File.basename($0)} 100 eur usd" exit end require 'ubygems' require 'open-uri' require 'hpricot' url = "http://xurrency.com/#{ARGV.join('/')}/feed" doc=Hpricot(open(url).read) puts (doc/'dc:value').inner_html
URL: http://www.arnebrasseur.net
Comments
