Notes

Short thoughts, interesting finds, and things worth remembering.

Mole helped me clean 60GB on my Mac

Found this open source tool called Mole that cleans up your Mac. Freed up 60GB of space without much effort.

It’s basically an open source alternative to CleanMyMac. You can clean cache files, remove apps properly (it deletes all the leftover junk too), and see what’s taking up space on your disk.

brew install mole
mo clean

Pretty straightforward to use. If you’re running low on storage, give it a shot.

I stopped using npx

Added a quick hook to my .zshrc that automatically adds ./node_modules/.bin to my PATH whenever I change directories.

Honestly, it’s such a quality of life improvement. No more typing npx tsc or npx vite — just tsc or vite. If the binary is there, it runs. If not, it errors out like normal.

Here’s the snippet I’m using:

function add_node_modules_to_path() {
  if [[ -d "./node_modules/.bin" ]]; then
    if [[ ":$PATH:" != *":./node_modules/.bin:"* ]]; then
      export PATH="./node_modules/.bin:$PATH"
    fi
  fi
}

add-zsh-hook chpwd add_node_modules_to_path
add_node_modules_to_path

The chpwd hook triggers every time you cd into a new folder, so your PATH is always fresh. Simple, but effective.

Finally runs after return

If you return inside a try block in JavaScript, the finally block still executes.

function test() {
  try {
    return "Return Value";
  } finally {
    console.log("Finally Log");
  }
}

console.log(test());
// "Finally Log"
// "Return Value"

The catch: returning inside finally overrides the original return.

function test() {
  try { return 1; }
  finally { return 2; }
}
// Returns 2 🤯

Don’t return in finally.