Skip to content

Instantly share code, notes, and snippets.

@brandonhilkert
Forked from chrishunt/house_hunting.rb
Created April 25, 2013 22:57
Show Gist options
  • Save brandonhilkert/5463915 to your computer and use it in GitHub Desktop.
Save brandonhilkert/5463915 to your computer and use it in GitHub Desktop.
# Be notified when a new house matching your criteria is posted to Craigslist
require 'snoop'
MAX_RENT = 1900
BEDROOMS = 2
CITY = 'portland'
CATS = true
DOGS = true
snoop = Snoop::HttpNotifier.new url: begin
url = [
"http://#{CITY}.craigslist.org/search",
"/apa?zoomToPosting=&query=&srchType=A",
"&maxAsk=#{RENT}",
"&bedrooms=#{BEDROOMS}"
].join
url += "&addTwo=purrr" if CATS
url += "&addThree=wooof" if DOGS
end
snoop.notify while: -> { true }, delay: 300 do
`terminal-notifier -message "New listing!"`
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment