Fun with ES2015: Pascal

Just some fun code to determine Pascal's triangle for a certain number using some (borderline unreadable 😄) ES2015 patterns.

// Utils
const last = arr => arr[arr.length - 1]
const withoutLast = arr => arr.slice(0, -1)
const sumWithNext = arr => (val, index) => val + arr[index + 1]

// Sum the values from a row
const createRowValues = arr => withoutLast(arr).map(sumWithNext(arr))

// Create row padded by the start values
const createRow = (previous, start) => [

// Appends a new row based on the last row
const appendRow = start => rows => [
  createRow(last(rows), start)

// Takes a starting value and the number of rows and returns a nested array
const pascal = (rows, start = 1) => [...Array(rows)].reduce(


// [ [ 1 ],
//   [ 1, 1 ],
//   [ 1, 2, 1 ],
//   [ 1, 3, 3, 1 ],
//   [ 1, 4, 6, 4, 1 ],
//   [ 1, 5, 10, 10, 5, 1 ],
//   [ 1, 6, 15, 20, 15, 6, 1 ],
//   [ 1, 7, 21, 35, 35, 21, 7, 1 ],
//   [ 1, 8, 28, 56, 70, 56, 28, 8, 1 ],
//   [ 1, 9, 36, 84, 126, 126, 84, 36, 9, 1 ],
//   [ 1, 10, 45, 120, 210, 252, 210, 120, 45, 10, 1 ] ]

Bulk Edit Strava Activities Plugin


Check out the GitHub repo or demo gif.

At some point earlier this year, I wanted to change all my activities from private to public (gotta get on those segment leaderboards!). This looked like a hassle to do by hand, and I'm always looking for a good excuse to prove the XKCD Theory of Automation. So I started coding.

Read more

Deploying Greenkeeper PR Branches with Surge and Codeship

As I've mentioned before, Greenkeeper is pretty great. Another tool I love is Surge, which allows you to quickly and easily publish any static content to the web. These two tools can be combined in a pretty cool way to allow you to see a built version of your site anytime Greenkeeper finds a release that doesn't match your versioning strategy.

Read more

React Invariant Violation / Minified Exception on iOS 8 with Webpack + Babel


Check out this gist to see the bug.

I ran into a head-scratcher over the weekend that I needed document, because I spent a few more hours than I wanted to trying to see why a deployed project wasn't working at all on iOS 8.4.

My project is using react, webpack, and babel. One of the babel plugins I'm using is babel-plugin-transform-react-inline-elements which transforms react elements to increase performance in production.

I'm also using the babel-polyfill (which includes the core-js shim) to polyfill some features like Symbols.

The project was working fine locally on iOS 8, but when deployed I was getting an error from react.

Read more


Over the course of ~36 hours last weekend greenkeeper notified me of two of my projects where the build was broken by minor updates to tools that I was using.

Here is one of the nice PRs, from what is quickly becoming one of my favorite services:

One was a bug in a babel plugin that I use to treeshake my lodash methods to decrease the overall bundle size, and the other was a change to eslint that broke babel-eslint.

While it's kind of a bummer to get emails that your projects can't build right now due to changes you didn't make it, that is more than offset by knowing about it almost so quickly and being able to easily pin the dep to the previous working version.

In the case of babel-plugin-lodash greenkeeper notified my in less than 8 minutes (!!), and I was able to fix my project, go to the module's repo, find out that the issue wasn't reported yet, come up with test case to reproduce the bug only in the latest version, and hopefully save other developers time in tracking down the issue.

But my favorite part is now that I have a few projects with pinned dependencies, greenkeeper will then notify me of the next update to the package and see if my software is working again. If it is working, all I have to do is merge the pull request and I'm back on the latest version knowing that my software is working as it did before.

I now have greenkeeper enabled on 6 of my bigger open source projects, and it would be a no brainer to pay for to use on private projects.

Update 08 Mar 2016

Greenkeeper opened a PR 4 minutes and 27 seconds after babel-plugin-lodash was published and then a little bit later my CI tests on Travis notified me that the build from the PR was passing. I had to make one small change to set the version back to a range, since greenkeeper assumes you always want to keep the same type of version declaration (which is the desired behavior in most other cases).

Thanks again Greenkeeper!