JavaScript
📄️ Cloudflare worker for DNS01 validation
This script allows to prove ownership of a domain for the purposes of getting a wildcard TLS certificate through ACME. While Traefik can connect to many DNS providers automatically, there is a risk that if Traefik is compromised by an attacker, the attacker will gain full access to the DNS provider account. By using this script instead, Traefik only has credentials with a very limited blast radius. The script is hosted on Cloudflare workers instead of on the application servers, so that a compromise of the application server does not lead to a disclosure of the Cloudflare credentials.
📄️ HTTP server
This code snippets is a simple HTTP server that works with Promises. It has no external dependencies.
📄️ Mini-Hyperscript
This snippet allows you to render HTML in a declarative way. It is especially useful in an environment where you don't want to load a full library like React, for example if you're writing a Tampermonkey script.
📄️ Multi-core launcher
When you build a Node.js application, it only uses a single thread by default. If you have a multi-core server available, it can be useful to run multiple instances of your application to make use of the additional cores.
📄️ Native Fetch in Node.js and Typescript
Node.js includes a fetch function since version 18. Unfortunately, this fetch function is not yet available in the Typescript types for Node.js. By including the file below in your project, you still get access to the right Typescript types.
React
📄️ Dark mode
This hook detects whether the user's device is configured to be in dark mode. It automatically updates when the device's mode changes.
📄️ Query parameter
This hook reads the initial value of a query parameter and makes it available. It also offers a function to update the query parameter. When the query parameter is updated, this hook's returned value does not change. This is to avoid infinite loops in the application's state.