Silly script for the day

So, you’d like to submit a URL to Open Laboratory 2008, you want to know if it’s already in Bora’s list and your machine runs Ruby? I thought so!

Save the following code as “bora.rb”, make it executable and run:

require 'rubygems'
require 'hpricot'
require 'open-uri'

def check_url(url)
  d = Hpricot(open(""))'a[@href]').each {|a|
    if url == a['href']
      return "Already submitted:  #{a.inner_text}"
  return "No exact match found"

puts check_url(ARGV[0])

It will only match identical URLs and is missing all kinds of checks and tests.