Skip to content

Instantly share code, notes, and snippets.

@chrishunt
Last active December 16, 2015 16:19
Show Gist options
  • Save chrishunt/5462643 to your computer and use it in GitHub Desktop.
Save chrishunt/5462643 to your computer and use it in GitHub Desktop.

Revisions

  1. chrishunt revised this gist Apr 25, 2013. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions house_hunting.rb
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,5 @@
    # Be notified when a new house matching your criteria is posted to Craigslist

    require 'snoop'

    MAX_RENT = 1900
  2. chrishunt revised this gist Apr 25, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion house_hunting.rb
    Original file line number Diff line number Diff line change
    @@ -18,6 +18,6 @@
    url += "&addThree=wooof" if DOGS
    end

    snoop.notify while: -> { true }, delay: 5 do
    snoop.notify while: -> { true }, delay: 300 do
    `terminal-notifier -message "New listing!"`
    end
  3. chrishunt revised this gist Apr 25, 2013. 1 changed file with 2 additions and 4 deletions.
    6 changes: 2 additions & 4 deletions house_hunting.rb
    Original file line number Diff line number Diff line change
    @@ -6,20 +6,18 @@
    CATS = true
    DOGS = true

    def url
    snoop = Snoop::HttpNotifier.new url: begin
    url = [
    "http://#{CITY}.craigslist.org/search",
    "/apa?zoomToPosting=&query=&srchType=A",
    "&maxAsk=#{MAX_RENT}",
    "&maxAsk=#{RENT}",
    "&bedrooms=#{BEDROOMS}"
    ].join

    url += "&addTwo=purrr" if CATS
    url += "&addThree=wooof" if DOGS
    end

    snoop = Snoop::HttpNotifier.new url: url

    snoop.notify while: -> { true }, delay: 5 do
    `terminal-notifier -message "New listing!"`
    end
  4. chrishunt revised this gist Apr 25, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion house_hunting.rb
    Original file line number Diff line number Diff line change
    @@ -20,6 +20,6 @@ def url

    snoop = Snoop::HttpNotifier.new url: url

    snoop.notify while: -> { true }, delay: 5 do |content|
    snoop.notify while: -> { true }, delay: 5 do
    `terminal-notifier -message "New listing!"`
    end
  5. chrishunt revised this gist Apr 25, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion house_hunting.rb
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    require 'snoop'

    BEDROOMS = 2
    MAX_RENT = 1900
    BEDROOMS = 2
    CITY = 'portland'
    CATS = true
    DOGS = true
  6. chrishunt revised this gist Apr 25, 2013. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions house_hunting.rb
    Original file line number Diff line number Diff line change
    @@ -1,16 +1,16 @@
    require 'snoop'

    BEDROOMS = 2
    MAX_RENT = 1900
    CITY = 'portland'
    RENT = 1900
    CATS = true
    DOGS = true

    def url
    url = [
    "http://#{CITY}.craigslist.org/search",
    "/apa?zoomToPosting=&query=&srchType=A",
    "&maxAsk=#{RENT}",
    "&maxAsk=#{MAX_RENT}",
    "&bedrooms=#{BEDROOMS}"
    ].join

  7. chrishunt renamed this gist Apr 25, 2013. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  8. chrishunt created this gist Apr 25, 2013.
    25 changes: 25 additions & 0 deletions test.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,25 @@
    require 'snoop'

    BEDROOMS = 2
    CITY = 'portland'
    RENT = 1900
    CATS = true
    DOGS = true

    def url
    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 = Snoop::HttpNotifier.new url: url

    snoop.notify while: -> { true }, delay: 5 do |content|
    `terminal-notifier -message "New listing!"`
    end