NotesToSelf.Dev (@NotesToSelfDev) header
NotesToSelf.Dev (@NotesToSelfDev) profile picture

Developer notes for myself

Joined March 2021
Be careful with Node file globbing vs bash globbing There’s a common gotcha when using commandline tools that have their own file globbing, such as Prettier in Nodejs. This command is supposed to run prettier against all the .ts files in all folders… notestoself.dev/posts/be-car…
Productivity with random numbers One little productivity trick I use is to select tasks or work with a random number. The simplest form is numbering a list of things you could do, then selecting one randomly. notestoself.dev/posts/produc…
1
1
15
Loop try catch A simple cause of failure in software systems is a single problematic item in a set causing the entire set to fail. Trivially, it looks like this: for (const item of items) { processItem(item) } When something goes wrong in processItem()… notestoself.dev/posts/loop-t…
1
2
Ask your interview candidates to ask you an algorithm question in return Here’s a potential idea to improve the technical interviews that you run: if you use algorithm questions in interviews, ask candidates to ask you an algorithm question as well. notestoself.dev/posts/interv…
1
2
Easier interface segregation in TypeScript (even better than Go!) Preamble: Introduction to interface segregation (Skip this if you’re aware of what the Interface Segration Principle is.) The Interface Segration Principle is the I in the SOLID mnemonic. notestoself.dev/posts/easier…
Python iterator chunk generator function Here’s a versatile Python function that splits any iterator into chunks of size n as a generator. It can take simple iterators such as lists, but also take a generator and chunk it without unwinding the whole… notestoself.dev/posts/python…
1
1
3
eslint changed TypeScript files only It’s best if a linter is applied from the beginning of a project, and with default linting rules, as that way the project benefits from the linting with the minimum possible effort. notestoself.dev/posts/eslint…
1
1
Keeping the ElasticSearch service running on an Ubuntu server A local ElasticSearch instance powers the Chinese example sentence search feature on Chinese Boost. This works fine, but the ElasticSearch instance has a habit of crashing about once a day. notestoself.dev/posts/keep-e…
A bad mix of bash and sh with [[ If you accidentally run a bash script with sh, you’re probably going to have a bad time. One little gotcha is the use of [[ (double square brackets) in bash. E.g.: if [[ -z "${PROJECT_ID}" ]]; then echo notestoself.dev/posts/a-bad-…
Problem maximisation A common metaphor about the potential dangers of AI is called “paperclip maximisation”. The idea is that an AI tasked with producing paperclips could figure out that it can produce more paperclips by e.g. notestoself.dev/posts/proble…
1
7
Beware of SQL averages over dates with empty days It’s pretty common to use SQL to extract sales summaries from tables that represent sales orders as rows. These kinds of queries often use the AVG() aggregate function to summarise the sales volume. notestoself.dev/posts/beware…
3
Bash script to run CDK synth only if there are changed TS files The cdk synth command can be pretty slow, even when running for a single small stack. We also often want to run the CDK synth command regularly as part of local development setups, so it’s… notestoself.dev/posts/cdk-sy…
17