I've been working on an app that asks for the user's zip code as part of an application process. I thought it would be pretty nice if I could leverage my old angular geolocation service and layer in some geocoding. After browsing around I found a way to do this using the Google Maps geocoder service.

This code will use the brower's geolocation to determine your latitude/longitude and pass that into the google maps geocode api. The geocoder will return a whole bunch of other details such as your city, state, address, etc - but this code only cares about your zip code right now.

Something to keep in mind is that I'm not including a google maps API key in this example, and I'm not certain what the limitations are, so this isn't exactly production ready.

Continue Reading

Here is a small service I wrote which will use the openweathermap.com weather service in angular.

This can easily be adapted to work with the angular geolocation service I posted last week. You can see this working in the weather service gist, but I removed it in the JSFiddle to keep it simple.

Continue Reading

Here is a small piece of code that can be dropped into an angular project and used to get the users geolocation through the browser.

The first few times I tried it I was hung up on the scope not updating, but $rootScope.$apply seemed to get around that. Here is a JSFiddle to see how this works.

Continue Reading

I wrote a small node app that watermarks images as an inside joke between friends, and I learned some pretty neat tricks along the way. The app will take a URL to an image and overlay a gigantic hand over it. On the useful scale, it is hovering at around a 3 (someone must have a use for this somewhere, right?) but it took a lot of Googling to make this work.

One of the big challenges for this was that I wanted to host it on heroku, and being a read-only filesystem I had to process all the images without touching the filesystem. Finding out how to do this in node was surprisingly difficult at the time.

Continue Reading

Ever use jQuery and think the .bind() and .trigger() APIs are nice? Here is a small class you can use when writing CoffeeScript to quickly implement the observer pattern in your own objects.

For more involved scenarios, consider using a library like RxJS.

Continue Reading

I'll start off by saying that I love Google's JSAPI. The other day all hell broke loose when, due to internal server issues, http://www.google.com/jsapi started throwing up 503 errors -- which subsequently broke JavaScript in all 12 or so internal apps using JSAPI. In other words, a major headache since I was faced with having to manually update the apps with the proper JS dependencies. Luckily I found out where those jsapi libs were stored, and through another stroke of luck found that they were resolving properly. So for any of you out there that get yourself into this odd situation, or wish to avoid using google.load(...) by directly linking to the libraries themselves, here ya go.

Continue Reading

I recently had to format large numbers using JavaScript and was really missing Rails' numberwithdelimiter function. Heres a simple version for JavaScript.

Continue Reading