Things I Learned This Week


A few things that caught my attention this week.

CSS Anchor Positioning

The anchor() function is now available in Chrome and Firefox. It lets you position an element relative to another element anywhere in the DOM, without JavaScript.

.tooltip {
  position: fixed;
  position-anchor: --trigger;
  top: anchor(bottom);
  left: anchor(center);
}

This replaces a huge amount of JavaScript positioning logic in tooltip and popover libraries. The API feels natural once you get past the initial anchor-name setup.

Rust Error Handling with thiserror

I’ve been using thiserror for structured error types in Rust. It derives Display and Error implementations from attributes:

use thiserror::Error;

#[derive(Error, Debug)]
pub enum AppError {
    #[error("database connection failed: {0}")]
    Database(#[from] sqlx::Error),

    #[error("invalid configuration: {field}")]
    Config { field: String },

    #[error("not found")]
    NotFound,
}

Much cleaner than manual impl Display blocks for every error variant.

Git Worktrees

git worktree lets you check out multiple branches simultaneously in separate directories. Useful when you need to reference one branch while working on another:

git worktree add ../myblog-fix-header fix/header-layout

This creates a new working directory linked to the same repository. No stashing, no context switching. When you’re done, git worktree remove cleans it up.