Skip to content

Instantly share code, notes, and snippets.

@mcoms
Created February 17, 2014 15:37
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 mcoms/9052798 to your computer and use it in GitHub Desktop.
Save mcoms/9052798 to your computer and use it in GitHub Desktop.
Ruby contractor daily rates (London)
require 'nokogiri'
require 'open-uri'
doc = Nokogiri::HTML.parse open('http://www.itjobswatch.co.uk/contracts/london/ruby.do')
# Inside London...
cells = doc.css('table.summary>tr').find {|tr| tr.css('>td').text =~ /Average daily rate/ }.css 'td'
daily_rates = { three_months: cells[1].text, last_year: cells[2].text, two_years_ago: cells[3].text }
# => {:three_months=>"£425", :last_year=>"£400", :two_years_ago=>"£375"}
# Outside London...
cells = doc.css('table.summary>tr').find {|tr| tr.css('>td').text =~ /UK excluding London average daily rate/ }.css 'td'
daily_rates = { three_months: cells[1].text, last_year: cells[2].text, two_years_ago: cells[3].text }
# => {:three_months=>"£325", :last_year=>"£325", :two_years_ago=>"£400"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment