Skip to content

Instantly share code, notes, and snippets.

@r00k
Created May 27, 2010 18:39
Show Gist options
  • Save r00k/416171 to your computer and use it in GitHub Desktop.
Save r00k/416171 to your computer and use it in GitHub Desktop.
#!/usr/bin/ruby
require 'rubygems'
require 'open-uri'
FILE_NAME = '/home/beno/projects/training_checker/seats_left.txt'
previous_seats_left = File.open(FILE_NAME).read
doc = open('https://training.thoughtbot.com/courses/12-vim-for-rubyists/registrations/new').read
seats_left = doc.scan(/\d\d seats/).first.split(' ').first
if seats_left != previous_seats_left
File.open(FILE_NAME, 'w') { |f| f.write(seats_left) }
%x(mail -s "New reg!" [email protected] < #{FILE_NAME})
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment