Silly countdown to spring with jQuery

I hate winter. I need up-to-date data every couple of days telling me exactly how much more of winter I have to endure. I don’t trust foreign and/or unproven sources for this knowledge, I had to create something myself.
Here’s what I used:
- Apache2 and jQuery
- The Final Countdown plugin http://hilios.github.io/jQuery.countdown/
Allocate a folder or something, example /var/www/html/spring,
change to it, and download the plugin:
➜ ~ wget -q https://github.com/hilios/jQuery.countdown/releases/download/2.2.0/jquery.countdown-2.2.0.zip
➜ ~ unzip jquery.countdown-2.2.0.zip
➜ ~ cd jquery.countdown-2.2.0
➜ ~ cp jquery.countdown.js /var/www/html/spring
Make sure you have jQuery, too.
Create a file /var/www/html/spring/index.html
with the contents below:
Navigate to where you configured your web server to serve this, e.g., http://127.0.0.1/spring
. You should see the countdown exactly as shown in the first picture.
But wait, I don’t want to use a web browser…
Oh, of course you don’t. Scrape your site via the CLI. Yes, you could just use a one-liner to calculate the days remaining, but that doesn’t sound very fun to me.
If you’re on a Mac, and using Homebrew, grab PhantomJS from homebrew/cask.
➜ ~ brew tap homebrew/cask
➜ ~ brew install — cask phantomjs
Also, install w3m for later.
➜ ~ brew install w3m
Create a local file ~/save_page.js
.
And create wrapper script to call it at ~/spring.sh
Finally, run it:
➜ ~ chmod +x ~/spring.sh
➜ ~ bash ~/spring.sh
Done.
Hopefully, one day a countdown to something will be desperately needed, and you’ll be prepared.
Mistakes? Did I miss anything? Let me know.