A solution to https://twitter.com/kangax/status/435478540210147328