Skip to content

Instantly share code, notes, and snippets.

@scottlowe
Created November 27, 2012 19:55
Show Gist options
  • Save scottlowe/4156611 to your computer and use it in GitHub Desktop.
Save scottlowe/4156611 to your computer and use it in GitHub Desktop.
A REPL tool to help Clojurians bag a Nexus
; Clojure is your friend and it will help you bag that Nexus you wanted.
; Paste into your REPL, sit back and wait in comfort. Checks every 60 seconds.
(import 'java.util.Date)
(import 'java.util.concurrent.Executors)
(import 'java.util.concurrent.TimeUnit)
(use 'clojure.java.browse)
(def nexus-page "https://play.google.com/store/devices/details?id=nexus_4_16gb")
(defn alert-clojurian []
(browse-url nexus-page)
(System/exit 0))
(defn check-for-nexus []
(if (re-find #">Sold out<" (slurp nexus-page))
(println (str (Date.) " - Nexus is still sold out :-("))
(alert-clojurian)))
(.scheduleAtFixedRate (Executors/newScheduledThreadPool 1)
#(check-for-nexus)
0 60 TimeUnit/SECONDS)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment