For the past 5 years @SquawSnow has been sending out a tweet whenever it snows at Squaw Valley (which is not often enough these past few years).
This was done by a PHP script that scraped Squaw's snowfall tracker every hour to check for changes. But last month I was looking to build something “real” in Node and decided that rewriting this script would be a good place to start.
Analysis paralysis is the state of over-analyzing (or over-thinking) a situation so that a decision or action is never taken, in effect paralyzing the outcome. (Wikipedia)
It's natural to want to do things "the right way", and I just kept thinking; Is this package already outdated? Is this random person on GitHub actually maintaining this package? Will X play nicely with Y? What would someone experienced use here? Didn't I just read something about a fork of Node that was going to progress even faster?
Perhaps this is just typical of all newer languages/frameworks and I had false expectations about Node feeling more mature given its popularity. Turns out that the Node ecosystem poses a challenge for some experts as well:
So maybe that's just the way it's gonna be. Time to make some choices and start coding.
After a reading a few tutorials and opinions I decided a few things:
- I'd use Node 0.11x invoked with the
--harmony flag for ES6 for generator support (details). After using Twisted's deferred.inlineCallbacks for years I can't imagine returning to callback hell. And flow control libraries like async still feel dirty to me. Language-level support is where it's at.
- Koa looked like a nice basic web framework to start with.
- Heroku would make a nice host since they support Node well.
And here's the code: https://github.com/powdahound/squawsnow
It really doesn't do all that much, so didn't take too long to put together. The hardest part was probably figuring out which external packages were going to play nicely with ES6 generators/Promises for Koa. There are surely things I've done wrong but it's in the wild and I learned a lot along the way. If this project were of more importance, this might even be one to throw away.
Now I wonder how things will change before my next Node project...
Since 2011 this site has been powered by WordPress running on m1.medium Amazon EC2 instance. It became neglected once HipChat took off and the version of Ubuntu it was running, Natty Narwhal (11.04), stopped being supported on October 2012... Oops! Instead of trying to upgrade the host I figured I’d take the opportunity to simplify things and try out some new tools.
From WordPress to Jekyll
First off, I really don’t need a beefy database-backed CRM powering the site, so WordPress is out. In its place I’ve chosen Jekyll, the static website tool that powers GitHub Pages. Hugo also looked appealing but lacks the ecosystem of themes and support that Jekyll has. Since I’d like to spend more time writing for the blog instead of tinkering with it, Jekyll wins. (I'm sure Hugo will catch up in time - it seems like a very well run project.)
Jekyll is also nicely supported by GitHub Pages but I saw scattered complaints about their CDN settings and limitations placed on Jekyll plugins so have decided to host the content on Amazon S3 instead.
Ideally I wouldn’t have to worry about deploying site updates to S3 at all, and Travis CI is the tool to make that happen. It watches the site's GitHub repo for changes and pushes them over to S3 with the help of the s3_website gem. This post from one of the Travis CI employees shows how easy it is to set up.
Note to self: ec2instances.info would benefit from some Travis CI love as well!
Over to Heroku
The few other non-static services and sites I hosted have been moved to Heroku and run fine on their free tier.
- s3browser, which powers files.powdahound.com, got some minor updates so it will run nicely on Heroku
- The nasty PHP script powering @SquawSnow was rewritten as a node.js app (will do a followup post on this)
Simple and cheap
I now have zero servers to worry about maintaining and will save $60/month in hosting costs. Now to kick off some of the other projects on my list and blog about them so this new setup gets some use!
In early April I ordered a Nexus 5 to replace my two year old iPhone 4s. It's the first Android device I've ever owned so I've had to learn a lot of new behaviors. While doing so, I've kept a list (in Google Keep) of anything that I've found to be noticeably better or worse than iOS. Lots of my iOS-only friends have been surprised to hear about many of the differences so I'm including it here with comments added. It should also be fun to read in a few years when all of this is horribly outdated.
Better on Android / Nexus 5
- Voice interaction - I hardly used Siri on my iPhone but use the "OK Google" features all the time on my Nexus. It's easier to start using (you just say "OK Google") and it very rarely misinterprets what I say.
- Notifications list - On Android, the notifications in the top-of-screen pulldown can have action buttons on them, show rich content like images, intelligently group by app (yet stay in chronological order), and are just more useful than on iOS.
- Home screens / icons - Being able to place app icons wherever you want is great. And being able to entirely remove icons you don't want is even better. There's no need to make that "Unused" folder on Android that you stick the Stocks/Video/Compass/etc apps in. Instead, any apps you don't have represented on your screen can be found in a big Launchpad-like menu.
- There's a "+1" button when you have a timer running which just adds 60 seconds. I use this a lot, especially when grilling. :)
- Permanent buttons at the bottom of the screen for "back" and "switch apps". It's great to have a back button in such an easy to hit location (instead of iOS' top left buttons) and it works the same way in almost all apps so you don't have to learn specific behavior. And the app switcher button is so much easier to hit than double-tapping the iOS home button. I find myself using it much more often.
- Google Apps are better. Not too surprising. But since I use them a lot, this makes a big improvement to my daily usage.
Better on iOS / iPhone
- Notifications show up on the lock screen. On Android the phone will make noise or beep but you still have to tap a button to turn it on, then swipe down the top menu to see the contents. It's a real pain, especially if someone texts you while you're doing something else (video games, cooking, etc) and you can't simply glance over at your phone and see what's up.
- Home button on the front of the phone. On the Nexus the on/off button is on the side which makes it far harder to hit quickly with one hand. It also has the added benefit of helping you glance at your phone and understand which way its facing. I end up picking up my Nexus upside down all the time.
- Bottom swipe menu gives quick access to flashlight/camera/etc. On Android you can get access to some stuff from an icon in the top swipe menu, but there's no flashlight option built in.
- App quality. Looking for apps in the Play store reminds me of browsing for Windows shareware in the early 2000s. There are lots of crappy options full of ads that make it harder to find the good stuff.
- Battery percentage in the toolbar. You have to install a special Android app to get this, and even then it ends up showing on the top left, not top right. Feels awkward.
There's a lot of other random stuff I prefer on one phone or the other, but overall I am much happier being on the new setup. Of course, upgrading from two year old hardware was going to be a big improvement either way.