Answer to this stackoverflow question which really just needed a bit of work to the forEach loop. Also, the gist was created from the command line using gist-put by Andy Winterman.
forEach