Bookmarks (RSS feed)

The web is for exploring, for surfing, so I collect web pages that I find interesting or handy here on my own web site. Have a browse and get lost in the World Wide Web.

Typescript Array.filter(Boolean)

A pattern I often use in my code is to use a map that produces a slightly different result, with nulls, and use filter(Boolean) to remove those nulls. It turns out TypeScript does not allow it. This blog post has a solution to that, it feels unnecessary but seems to work well.

Day.js

"Day.js 2KB immutable date library alternative to Moment.js with the same modern API" This seems like a good step forward, Moment is brilliant it is quite large, this could be a good replacement.

Remove SVG Whitespace

Quite often I need a quick way to trim an SVG so it has no whitespace, I use this JS Fiddle I found as it makes it really simple to do. I'm not sure who wrote it but it basically modifies the viewbox to be the SVG's bounding box then returns the updated SVG. Nice and simple.

[PDF] A Model for Reasoning About JavaScript Promises

This is an open access article written by Magnus Madsen, Ondřej Lhoták and Frank Tip, published by the ACM in 2017. I'm bookmarking it here to read later but it appears to provide a framework to better understand Promises in JavaScript. According to the abstract: "Based on λp, we introduce the promise graph, a program representation that can assist programmers with debugging of promise-based code."