Created
May 27, 2010 18:39
-
-
Save r00k/416171 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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