Created
November 27, 2012 19:55
-
-
Save scottlowe/4156611 to your computer and use it in GitHub Desktop.
A REPL tool to help Clojurians bag a Nexus
This file contains 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
; 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