22 Dec 2016, 12:56

2016 roundup

So another year draws to a close and I thought I would review the last 12 months in my favourite data struture; lists. Think of this as a far less interesting homage to Fogus yearly reviews.



Over the last few years I consume less technical books purely because the content to be found online can be of great quality and books can rarely keep track with the rate of change in tech. Usually if I am reading a tech book its of a more abstract or fundamental topic rather than specific to a language and is therefore a longer living.

Non Technical

Most people hate commuting but it allows me to consume audiobooks and podcasts at a rate that would be impossible otherwise. Almost all of these were “read” via audiobook:

Not listed are about 10 other books that I abandoned at the 10% mark, I used to stick with a bad book to the bitter end but not anymore.

Next up is The Gene: An Intimate History - Siddhartha Mukherjee as soon as I finish The Passage of Power.

Blog posts


Non Technical


I discovered almost no new music this year apart from a handful of albums.

  • The Black Keys - Their discography has been my background music for at least 2 years. Its on shuffle as I work almost constantly.
  • Radiohead - See above
  • Andrew Bird
  • Beck
  • Ben Howard
  • Chris Stapleton - I’m not a country fan at all but this dude has a great voice.
  • Daft Punk
  • Gary Clark Jr - Awesome
  • Kaleo
  • LCD Soundsystem
  • Raising Sand - Robert Plant and Alison Krauss - This one has been out a few years and I never got to it before now.
  • The White Stripes


Only two worth mentioning this year:

  • Hardcore History - Dan Carlin - Been listening to Dan for a few years now. He drops 3-4 audiobook length podcasts each year which are interesting both from a historical context but also in Dans perspective on how events happened.
  • Robert B. Peterson Podcast - This is pretty new, only started listening a week ago and only 2 episodes are up but the content is great. It seems to be a slight reworking of his Maps of Meanings lecture series into podcast form. Well worth checking out if you are interested in Psychology, Mythological Archtypes, Parenting and the realities of being a limited being.

TV Shows

Too many to list but here are the best ones:

  • Olive Kitteridge (HBO) - Set in Maine with Frances McDormand and Bill Murray. Interesting look at life, depression, repression.
  • Mr. Robot - Loved season 1, not so much Season 2.
  • Jessica Jones
  • The Walking Dead - I think this is like season 6 of a show centered around a simple core concept: “We have to survive”. But whatever, Zombies!
  • Westworld - Awesome, need to rewatch, best show I have seen for a long time.
  • Veep - Really enjoyed this.
  • The Night Of - Excellent
  • Peaky Blinders - “Tommy FOCKIN Shelby”
  • Always Sunny in Philadelphia - Excellent
  • Narcos - Excellent
  • Planet Earth 2 - David Attenborough and HD nature shots

On my list to watch:

  • Stranger Things - Seen 1 episode and enjoyed it.
  • Black Mirror - Ditto

Films enjoyed

Too many to list but here are the best ones:

  • Nocturnal Animals - Sparked a lot of conversation this one.
  • The Martian - Loved the book and the Movie.
  • The secret Life of Pets - Greate family Movie.
  • Finding Dory - Where the hell is she.

Youtube stuff

  • Primitive Technology - Dude in the outback recreating primitive tools and objects. I watch this with my son and he loves it.
  • Jordan B Peterson - Professor of Psychology at the university or Toronto, highly articulate and engaging speaker with well thought out arguments. I might not agree with everything he says but he covers several fundamental ideas.
  • Marques Brownlee - Dope tech reviews, possibly the only reviewer I gave seen who can edit and compose a shot worth looking at.
  • The Great War
  • Alt Shift X - Game of Thrones fans already know about this guy, great analysis videos.

Technical stuff encountered

Work related

Playtime related

  • .NET Core, .NET standard
  • F#
  • Javascript
  • Rust
  • Node

Stuff I wanted to do or learn but have not spent enough time on yet

  • More Arduino - I have tons of components waiting to be used in a crappy project that will kinda half work.
  • Teaching the kids programming - Starting to feel guilty about this one as it would be a great skill for them to learn. It is the modern equivalent of literacy to some degree.
  • Drones
  • Photography
  • Procedural generation
  • Running

Opensource code read

Reading code wrtten by other developers is a great way to learn new techniques and patterns.

Things I bought that had an impact.

  • Bose QC35 - I work in an Agile space, which basically means I sit in a big room with lots of other people and no partitions. People can be noisy, to help fix this most companies use a whitenoise generator which helps reduce noise by creating more noise. So yea I bought some noise cancelling headphones, silence is my drug of choice.
  • Nikon DSLR - I bought an entry level DSLR and some lenses with the goal of taking some better pictures of the kids as they grow up but also to try my hand at Astrophotography.

Countries visited

USA - Maine

We were very fortunate to get to spend an extended period of time in Portland Maine this summer! Beautiful spot and great people.

Plans for 2017

  • Read 50 books
  • Learn a programming language
  • Build a meaningful product
  • Have fun!

17 Feb 2015, 12:52

Javascript Equality Operator Grids

Javascript gets some bad press these days especially over how its comparison operators work.

I decided to extend Craig Gidneys example and added ===, !=, !== <, <=, > and .= comparisons.

Rows are the left side operand and columns are the right.

Source code on jsfiddle

16 Dec 2014, 22:34

Directed Graph of hubski users created with D3

Using some c# code to scrape hubski.com I was able to produce a pretty basic directed graph showing users follower connections.

Source code on github

Demo version

Advanced Demo version

I started off by scanning a users profile and recording various pieces of information such as: - Age in days - Number of followers - Number of people followed - Number of badges received.

I then looped over each of that users followers and recorded the same information, and then their followers, and then their followers… you get the idea.

I ended up thousands of accounts which was good but most of them only had 1 or 2 followers indicating a low level of social integration. I filtered out most accounts with less than 25 followers (a few did make it in) in order to represent the core social group members.

I graphed the data using D3 into a force directed graph that included all of the connections (follows) between each of the gathered members. There is some gravity applied to the area which results in the larger (more followed) users being drawn towards the center while the smaller users encircle them, like satellites basking in the glow of a shining sun, or hornets buzzing around fresh manure.

It’s a work in progress, search needs to be fixed…

06 Aug 2013, 15:03

Data Models, functional composition and validation

While I am working my way through the Functional Javascript book I came across something that could be really useful, especially when dealing with AJAX requests.

Functional Composition

In a nutshell you start with simple functions that do a single job and then chain them up to perform some larger task. In this example we want to validate that the json being returned from an AJAX call contains the properties we require. To do that we start with the following function:

function validator(message, fun){
    var f = function(){
        return fun.apply(fun, arguments);
    f['message'] = message;
    return f;

which takes a message string and a function as parameters and returns an object what can be called with an arbitrary number of arguments to perform a task. The returned object has a ‘message’ property assigned also.

Next we need a ‘driver’ function:

function checker(){  
    var validators = _.toArray(arguments);  
    return function(obj){  
        return _.reduce(validators, function(errs, check){  
                return errs;  
                return _.chain(errs).push(check.message).value();  
        }, []);  

that should be called with a list of validators as its arguments. It loads these into an array and returns a function which uses this array to validate the object ‘obj’. It will loop over each of the validators in the array and checks to see if the obj object passes each of them. If the check fails then it appends the validators ‘message’ to the list it will return. If all validators pass then the array returned will be empty.

Putting it all together

I can use my checker and validator functions to create a validation function like the following:

function isValidResourceItem(){
    var validators = checker(

        validator('obj can not be nul',
            function(obj){return !_.isNull(obj);}),

        validator('obj must contain title',
            function(obj){return !_.isNull(obj.title);}),

        validator('obj must contain canonicalVolumeLink',
            function(obj){return !_.isNull(obj.canonicalVolumeLink);}),

        validator('obj must contain description',
            function(obj){return !_.isNull(obj.description);})
    return validators;

which will help to ensure the data was returned in a format I expect and cut down on those ‘undefined’ errors you would get without something like this.


I reused an example from an earlier jsFiddle to test the idea out, I want to be sure the search results json object contains the properties I need to produce a results list.

Whats the point?

Well I guess it shows an easy way to take pieces of functionality, place them into small reusable functions and build upon them into a pretty powerful set of tools.

21 Jul 2013, 17:03

KnockoutJS demo using Google Books API



A quick and dirty demo to show off a very simple example of what you can do with some knockoutjs code and an AJAX call. I use the google books API to provide a simple search form.

Show me the Code


Check out the jsfiddle

I also use the underscore library to work with the observableArray but that is not really a requirement. I just like it.

So whats happening?

We start off by creating a simple html page that contains a text box, a button and a results list. In our javascript file we create a ViewModel object (function) that contains properties that match our html form. It has a field for searchInput, a function to handle searches etc. In our document ready function we apply this ViewModel to our html using ko.applyBindings(vm);. When we do this knockoutjs takes our html and resolves all the data-bind="" attributes we have added to elements and resolves them to fields on our ViewModel. This is called Model Binding and it is a powerful tool that allows us to have a single ViewModel property displayed in several places on a page, with each kept in sync to any changes. If the field we are binding to is a ko.observable then any changes made to its value will immediately show wherever it is bound.

We also use a ko.observableArray to hold our search results. When we initiate a search we make an AJAX call to the appropriate url and then parse the results. You can see the result structure we receive back by running curl -i https://www.googleapis.com/books/v1/volumes?q=potter (where ‘potter’ is what you want to search for). Once we receive the result we loop over the returned items and create a new resultItem to contain the information we want. These items are then added to our array, self.items.push(resultI); which thanks to knockoutjs gets rendered to our results div immediately. You can see that knockoutjs can iterate over collections by using the foreach:items databinding.

Whats the big deal?

Well this particular demo is about as easy as it gets, but even so it covers a few important topics: - Model View ViewModel pattern. - Model Binding as it applies to Knockout - Working with web API’s using JSON.

It shows what we can achieve with a few lines of code by building upon these powerful libraries. KnockoutJS is taking care of binding our ViewModel to our html and also updates that html whenever we change an observable. jQuery is handling the AJAX request for us.

21 Jul 2013, 15:03

Functional javascript using underscore

Functional javascript using underscore


A little while ago I picked up Functional Javascript by Michael Fogus. I’m only part way through it and to be honest I should probably have waited until I finished it before starting this post but…

There is a central theme to this book which intrigued me, indeed its one of the main tenets of functional programming. It can be summed up in this quote: >“It is better to have 100 functions operate on one data structure than 10 functions on 10 data structures.” - Alan Perlis

This is very different concept to what is normally seen in large enterprise level projects and applications. I have to say that I have spent a large amount of time writing code to map one model to another and back again. Its not fun. This functional stuff might be on to something.


Well Michaels book uses the underscore library for all of his examples and its a really powerful tool. I have started using it here and there on smaller projects and the more I use it the more I like it.


Project Euler is probably the go-to set of problems when developers try to learn a new language or framework. I don’t see why I should be any different. I have started a small project to play around with this and you can see it over on github.

Problem 1

If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. Find the sum of all the multiples of 3 or 5 below 1000.

Can be solved with a few lines of code like the following: return _.reduce(_.range(0,1000), function(memo, number){ if( number%3===0 || number%5==0) return memo+number; return memo;} );


Unit testing javascript has come a long way in the last few years and I have added a simple QUnit test runner to the repository.