Google Spreadsheet Geocoding Macro

I’ve been doing a bit of nerding around with a side project, which involves editing a bunch of addresses in Google Sheets and having to geocode them into raw lat/lng coordinate pairs.

google-sheets-geocode-macro

I went ahead and coded up a quick App Script macro for Google Sheets that lets you select a 3-column wide swath of the spreadsheet and geocode a text address into coordinates.

Update 10 January 2016:

The opposite is now true too, you can take latitude, longitude pairs and reverse-geocode them to the nearest known address. Make sure you use the same column order as in the above image: it should always be Location, Latitude, Longitude.

I’ve moved the source to Github here:
https://github.com/nuket/google-sheets-geocoding-macro

It’s pretty easy to add to your Google Sheets, via the Tools -> Script Editor. Copy and paste the code into the editor, then save and reload your sheet, and a new “Geocode” menu should appear after the reload.

Update 15 March 2021:

I’ve added code to allow for reverse geocoding from latitude, longitude pairs to the individual address components (street number, street, neighborhood, city, county, state, country).

I Like Everything Redux

A friend points out the fact that no on would ever use something like I Like Everything on their real personal account. I have to concede the point that, well, the plugin just turns the Like button clicks into a huge shared web-history, and no one really wants all that Like spam anyways.

In any case, as a proof of concept plugin for Chrome, I’m happy with what I learned about the Chrome extensions system and happy the thing worked. I’ve got another idea that I code up at some point, so the groundwork will transfer.

I Like Everything

I’ve written a new Google Chrome extension called I Like Everything.

The purpose of this plugin is to click all of the Like buttons is detects on the webpages a user is browsing, theoretically making it more difficult to separate the things one Likes from the things one doesn’t. After all, if you Like everything, then really you don’t Like anything.

The extension code, with instructions on how to install it, is at: https://github.com/nuket/ile

Testing REST API with LearnBoost’s Tobi + Vows.js

I've been looking for a clean, framework-independent way of doing white-box API testing using Node.js. For a long while, the things that popped up when doing a quick scan of the Node Package Manager package lists weren't ticking all of the right boxes: zombie.js is going for a full browser simulation but doesn't provide a simple Browser.post() method (you have to use selectors to find the form.submit button and then fire a click() on it), Node's native http.Client is too low-level and doesn't do cookies, and various other http request wrappers weren't quite cutting it either. I think I've found a solution for this particular version of the problem: LearnBoost's Tobi combined with Vows.js is letting me do clean REST API testing, with a minimum of hassle, and all the built-in sugar-coated goodness of should.js fluent assertions. For example: Future steps then include using the macros to help set up other tests that require a valid user, etc. Overall, this is the most straightforward solution I've yet found for the problem of testing a REST API while also faking a session.

Javascript Decorators

One reason why Javascript rocks:

As a use case, imagine you want to restrict a certain set of functions to only run if you are logged in. Doing stuff like this is ridiculously easy with first-class functions.

Here’s a generic decoration example:

Update: Here’s the specific way you’d do this with node.js/Express:

Since all of the URL handlers you register have the same signature, it’s easy to add precondition checks to the handlers via decorators.

You get preconditions essentially for free, which is a damn sight better than adding the if() block to each and every handler function. Also, if you need more preconditions in the future, you can just stack them.