til

320 posts tagged “til”.

  1. 2023
  2. Quick and dirty mock testing with mock_calls

    I needed to write a test that checked for a really complex sequence of mock calls for s3-credentials 3.

    1 min read
  3. Running Ethernet over existing coaxial cable

    I recently noticed that the router in our garage was providing around 900 Mbps if I plugged my laptop directly into it via an Ethernet cable, but that speed fell to around 80Mbps (less than 1/10th…

    2 min read
  4. Using Playwright MCP with Claude Code

    Short version: run this before starting : That's it! Now when you run Playwright will be available. You can say things like: And a visible Chrome browser window, controlled by Claude Code, will open…

    1 min read
  5. Scroll page to form if there are errors

    For a Django application I'm working on (this issue) I have a form that can be quite a long way down the page.

    1 min read
  6. Styling an HTML dialog modal to take the full height of the viewport

    Today I got Claude to build me an experiment to use it for a side panel that would slide in from the right hand side of the screen, looking like this: But what's with that gap at the bottom?

    3 min read
  7. Writing pytest tests against tools written with argparse

    I usually build command-line tools using Click (and my click-app cookiecutter template), which includes a really nice set of tools for writing tests.

    1 min read
  8. Running PyPy on macOS using Homebrew

    Towards Inserting One Billion Rows in SQLite Under A Minute includes this snippet: All I had to do was run my existing code, without any change, using PyPy.

    1 min read
  9. Scraping the Sky News Westminster Accounts, a Flourish application

    Sky News in partnership with Tortoise published a fantastic piece of investigative data reporting: the Westminster Accounts, a database of money in UK politics that brought together data from three…

    2 min read
  10. Understanding the CSS auto-resizing textarea trick

    Chris Coyier wrote about the new property, which can get a to automatically expand to fit its content - but currently only in Google Chrome Canary.

    5 min read
  11. Track timestamped changes to a SQLite table using triggers

    This is more of a "today I figured out" than a TIL. I have an idea to implement the Denormalized Query Engine design pattern using SQLite triggers.

    1 min read
  12. Rewriting a Git repo to remove secrets from the history

    I decided to make a GitHub repository public today that had previously been private. Unfortunately the revision history of that repository included some secret values, one of which I could not figure…

    1 min read
  13. Search across all loaded resources in Firefox

    You can search for a string in any resource loaded by a page (including across HTML, JavaScript and CSS) in the Debugger pane by hitting Command+Shift+F.

    1 min read
  14. Using Fabric with an SSH public key

    Inspired by this tweet by Mike Driscoll I decided to try using Fabric to run commands over SSH from a Python script, using a public key for authentication.

    1 min read
  15. Scroll to text fragments

    I ran a Google search this morning for and when I clicked on the top result it jumped me to a highlighted snippet of text on the page, despite that page not having relevant anchor links.

    1 min read
  16. Planning parallel downloads with TopologicalSorter

    For complicated reasons I found myself wanting to write Python code to resolve a graph of dependencies and produce a plan for efficiently executing them, in parallel where possible.

    1 min read
  17. literalinclude with markers for showing code in documentation

    I wanted to include some example Python tests in the Datasette documentation - but since they were tests, I also wanted to execute them as part of my test suite to make sure they worked correctly.

    1 min read
  18. Understanding Kristofer Joseph's Single File Web Component

    Via Brian LeRoux I found single-file-web-component.html by Kristofer Joseph. It's really clever! It demonstrates how to build a custom Web Component in a single HTML file, using some neat tricks.

    1 min read
  19. Searching for repositories by topic using the GitHub GraphQL API

    I wanted to use the GitHub GraphQL API to return all of the repositories on the https://github.com/topics/git-scraping page.

    1 min read
  20. List all columns in a SQLite database

    Here's a devious trick for listing ALL columns in a SQLite database, using a SQL query that generates another SQL query.

    4 min read
  21. Null case comparisons in SQLite

    I wanted to say "output this transformed value if it's not null, otherwise nothing". The recipe I figured out was: Full query example: This uses datasette-rure for the function.

    1 min read