David Walsh

git: Remove Untracked Files

I’ve always said that I know just enough about git to get the job done, but also do something destructive. Nothing embodies that more than my recent mistake. I somehow found a git repository full of untracked files and git stash wouldn’t fix it. Desperation led me to learning how to remove all untracked files, […]

The post git: Remove Untracked Files appeared first on David Walsh Blog.

Node isConnected

Every so often I discover a property in JavaScript objects that I didn’t know existed, oftentimes using another trick to accomplish the same functionality. One such property I just learned about was isConnected, a node property that attached to a context (i.e. document). Here’s how to use Node.prototype.isConnected: const el = document.createElement(‘div’); el.isConnected; // false […]

The post Node isConnected appeared first on David Walsh Blog.

Limit Promise Concurrency with pool

Methods like Promise.all, Promise.allSettled, Promise.race, and the rest are really excellent for managing multiple Promises, allowing for our apps to embrace async and performance. There are times, however, that limiting the number of concurrent operations may be useful, like rate limiting or simply not wanting to put a server under massive stress. Enter an simple […]

The post Limit Promise Concurrency with pool appeared first on David Walsh Blog.

How Hacker News Crushed David Walsh Blog

Earlier this month, David’s heartfelt posting about leaving Mozilla made the front page of Hacker News. Traffic increased by 800% to his already-busy website, which slowed and eventually failed under the pressure. Request Metrics monitors performance and uptime for David’s blog, and our metrics tell an interesting story. Here’s what happened, why, and what you […]

The post How Hacker News Crushed David Walsh Blog appeared first on David Walsh Blog.

Detect Changed Files with git

There are numerous reasons to want to know which files have been added or modified in a git repository, one of which is your text editor highlighting those files. Another use case is running tasks against only files which are presently changed, like lint or other validation routines. So how can we identify files which […]

The post Detect Changed Files with git appeared first on David Walsh Blog.