Skip to content

Instantly share code, notes, and snippets.

joeytwiddle /
Last active July 23, 2020 21:08
Me complaining about GitHub notification UI v2

This is what I sent to GitHub's feedback form (plus a few edits)

The new notifications page is blocking me from working on small open source projects!

The first thing I want to do is see the projects with the least new notifications. But you have truncated them off the bottom of the list! (The list down the left-hand side.)

With the old UI, I used to immediately scroll to the bottom, and interact with the small projects first, before reading the notifications of larger projects.

Why? Because these small activity projects are more likely to be projects with only a few contributors, where I can make the most impact. Sometimes they are even my own projects. These are usually the projects of most interest to me.

joeytwiddle / nn-images.html
Last active November 17, 2019 06:51
A neural network to generate images
<canvas id="canvas" width="512" height="512"></canvas>
<!-- <script src="./nn-image.js"></script> -->
class Network {
layers = []
weightsLayers = []
joeytwiddle /
Last active October 13, 2023 20:50
Add all forks of the current repo as remotes
#!/usr/bin/env bash
set -e
# See also: (same thing but in python)
origin_url="$(git remote show origin | grep 'Fetch URL:' | sed 's+.*: ++')"
full_repo_name="$(echo "$origin_url" | sed 's+.* ; s+\.git$++')"
const delay = (ms) => new Promise(resolve => setTimeout(resolve, ms));
const fn = (ms) => delay(ms).then(() => console.log('done after ' + ms));
// Sequential
async function test1() {
const [one, two] = [await fn(2000), await fn(1000)];
console.log('mikael1 finished');

Asking Good Questions

Suggestions to help you ask good questions on StackOverflow, GitHub issues and IRC, as well as when asking colleagues face-to-face.

General rule: Put at least as much effort into the question as you would like others to put into the answer.


  1. Check that you have the latest version of the software. (The bug might have already been fixed.)


I have used WebStorm at work for the past three years. But last month I used VSCode exclusively for four weeks, because I wanted to learn it. I noted my observations here.

Eventually, as a deadline approached, I switched back to WebStorm. Why? VSCode is very good, and I was impressed. But I still find WebStorm is slightly better at a few things which I use very frequently. These small improvements really add up when I'm trying to get stuff done.

In keeping with the Pareto principle, small advantages with only a few commonly used features are enough to make one editor stand out for me. Specifically, "Go to Definition/References", "Searching" and "Carrying imports" are so important, that just making these more convenient means that all other concerns are irrelevant.

So, for the reader's convenience, these are the first few features I will address below.

#!/usr/bin/env bash
set -e
cache_dir="$HOME/Library/Group Containers/"
if command -v find >/dev/null && command -v mktemp >/dev/null && command -v unzip >/dev/null && command -v grep >/dev/null
then :
echo "This script requires the follow executables to run: find mktemp unzip grep"
joeytwiddle / asyncWrappersForRestify.js
Last active October 7, 2019 02:57
Helper to use promises in restify (might also work for express)
* Use restify with promises
* Restify middleware and route handlers are passed a callback function `next`
* which must be called on success, or on an error.
* But you may prefer to define your middleware and routes using promises or
* async functions instead of using callbacks.
* To achieve that, simply wrap your middleware functions in `middleware()` and
joeytwiddle / cooldown-monitor.js
Created April 30, 2019 04:40
Cooldown Monitor
"use strict";
Simulates an object which can heat up and overheat, but with a constant rate of cooling over time.
Useful for throttling when you want to provide an initial allowance.
For example, it could be used to manage the overheating of a weapon in a game, or to avoid errors from generating huge logfiles, but without throttling the first few errors.
joeytwiddle /
Created November 6, 2018 05:07
Creates a file with an ext4 filesystem inside it, and moves Dropbox into that filesystem
set -e
set -x
# You could put the fs file and the mountpoint inside your home folder
# But that may not work if you are using a fuse-mounted homefolder (e.g. encrypted with encfs)