Manipulating query strings with URLSearchParams
The class, in every modern browser since IE 11, provides a sensible API for manipulating query string parameters in JavaScript.
Notes on software engineering
121–140 of 550 posts, newest first.
The class, in every modern browser since IE 11, provides a sensible API for manipulating query string parameters in JavaScript.
Once you have installed the "command line tools" for Catalina using the following terminal command: xcode-select –install will run Python 3.7.3: % which python3 /usr/bin/python3 % python3 Python 3.7.3…
I figured out how to serve a JavaScript project built using Vite using GitHub Pages and a custom build script that runs using GitHub Actions.
The command lists your services running on Google Cloud Run: It has two useful but under-documented options: which filters based on a special filter language, and which customizes the output format.
For my auto-updating personal README I needed to fetch the latest release for every repository I have on GitHub. Since I have 316 public repos I wanted the most efficent way possible to do this.
Xeophon suggested that E5-large-v2 as an embedding model that was worth a closer look. It's an interesting model. It's trained to match queries against passages of text.
A pattern I really like for zero-downtime deploys is the ability to "pause" HTTP traffic at the load balancer, such that incoming requests from browsers appear to take a few extra seconds to return…
It turns out GitHub Flavored Markdown can apply syntax highlighting to Python console examples, like this one: The trick is to use the following: pycon import csv with open('eggs.csv', newline='') as…
Readability.js is "A standalone version of the readability library used for Firefox Reader View". I figured out how to use the two of these together to extract the core content from a web page using…
I wanted the ability to paste the image on my clipboard into a command in the macOS terminal. It turns out only works with textual data - so copying a portion of a screenshot to my clipboard (using…
I decided to try out Quarto, the new notebook/markdown/publishing system built on Pandoc. I followed their Get started guide and downloaded and installed the macOS installer.
Jinja autoescaping is turned off by default. Coming from Django this frequently catches me out. You can turn on autoescaping for your Jinja environment using: But what about if you are using directly?
I continue to seek a solution to the Python sandbox problem. I want to run an untrusted piece of Python code in a sandbox, with limits on memory and time.
I wrote this test to exercise some httpx code today, using pytest-mock. The key was to use which patches the module that was imported by the module.
I've been trying to figure this out for ages. Tim Bart responded to my call for help on Hacker News with this extremely useful code example showing how to run Python code in WebAssembly inside Python…
Facebook's musicgen is a model that generates snippets of audio from a text description - it's effectively a Stable Diffusion for music.
Facebook's musicgen is a model that generates snippets of audio from a text description - it's effectively a Stable Diffusion for music.
Fly.io lets you deploy Docker containers that will be compiled as a Firecracker VM and run in locations around the world. Fly offer a number of ways to build and deploy apps.
I decided to use CSS grids for this. I started with GPT-4. My prompt: HTML and CSS to display a grid of four images, each with a paragraph caption below the image - use figcaption The 2x2 grid should…
Here's a PostgreSQL SQL query that returns the closest locations to a point, based on a brute-force approach where the database calculates the distance (in miles) to every single row and then sorts by…