Latest articles

408 new today · 7,366 articles · from 241 blogs

Mara Bos·

Writing Python inside your Rust code — Part 1

About a year ago, I published a Rust crate called inline-python, which allows you to easily mix some Python into your Rust code using a python!{ .. } macro. In this series, I’ll go through the process of developing this crate from scratch.

Ethan Marcotte··Ethan Marcotte

Constrained CSS grids without max-width.

AI summaryThe author shares a CSS Grid technique for capping a layout's width without max-width, by adding a flexible 'constraint column' defined with calc() — e.g., calc(100vw - 72rem) — which absorbs extra viewport space and prevents the main columns from growing beyond the target width. For centered layouts, the same approach can be mirrored on both sides using 50vw minus half the max width, with adjustments needed for gutters or grid-gap. This allows grid items to extend into the constraint column for full-bleed elements, treating the empty space around a design as a layout tool rather than defaulting to max-width.

Josh W. Comeau··Josh W. Comeau

CSS Variables for React Devs

AI summaryThis tutorial explores how CSS variables can be leveraged in React applications to create dynamic themes. It demonstrates how to maximize the use of CSS-in-JS tools like styled-components and challenges traditional assumptions about how media queries work.

Without Boats·

The problem of effects in Rust

AI summaryThe author argues that several seemingly separate discussions in the Rust community—such as writing fallible code inside iterator adapters and closures that maintain Tennant's Correspondence Principle—are all deeply interconnected. In his view, they all stem from what he considers one of the biggest design problems in Rust: the language's failure at version 1.0 to provide good support for handling common effects related to program control flow.

Ethan Marcotte··Ethan Marcotte

Writing my accessibility statement.

AI summaryThe author recounts realizing his website lacked an accessibility statement and spending a morning writing and publishing one, drawing inspiration from examples like Eric Bailey's, Vox Media's, and GOV.UK's. He explains that a good accessibility statement serves readers by describing the site's accessibility features, honestly acknowledging known issues, being maintained as a living document, and inviting feedback the author commits to addressing quickly.

Josh W. Comeau··Josh W. Comeau

Styling Ordered Lists with CSS Counters

Styling an ordered list can be surprisingly tricky; there's no way to get at that bullet! In this tutorial, we'll see a handy trick using CSS counters that lets us style ordered lists without breaking proper semantics. Keep reading.

Lil'Log·

The Transformer Family

[Updated on 2023-01-27: After almost three years, I did a big refactoring update of this post to incorporate a bunch of new Transformer models since 2020. The enhanced version of this post is here: The Transformer Family Version 2.0. Please

Without Boats·

A brief apology of Ok-Wrapping

AI summaryThe author argues for adding Rust syntax that automatically 'Ok-wraps' the return values of functions returning Result types, a feature they have long supported despite vocal opposition from many enthusiastic users. They sketch a possible design in which a function signature includes a 'throws' clause, return expressions yield the success type directly, a new 'throw' expression handles errors, and the existing '?' operator works unchanged.

Without Boats·

From failure to Fehler

AI summaryThe author recounts creating the Rust error-handling library failure about two and a half years ago, which quickly became one of the most popular error handling libraries in Rust. Its current maintainer has now deprecated the library, a decision the author strongly supports. In the same week, the author released a new and very different error-handling library called fehler, and the article discusses both, including how failure emerged when error-chain was the dominant option.

Lea Verou··Lea Verou

LCH colors in CSS: what, why, and how?

AI summaryThe article explains the advantages of LCH colors in CSS over the familiar sRGB/HSL model: LCH gives access to about 50% more colors beyond sRGB (matching modern monitors' wider P3 gamuts), is perceptually uniform, and has a lightness component that actually corresponds to perceived lightness. The author describes how LCH (Lightness, Chroma, Hue) works, notes that major browsers are beginning to implement it, and introduces an LCH color picker built at css.land/lch. A FAQ section clarifies common misconceptions, including LCH's relationship to the Lab color space and why color(display-p3) is only a partial, short-term solution.

Without Boats·

What constitutes a vulnerability?

AI summaryThe author argues that filing CVEs for Rust and its ecosystem libraries is at best silly and at worst harmful, as it muddies the definition of what a vulnerability actually is. They contend that this practice paints an overly negative picture of Rust's security situation, which can lead people to make inaccurate comparisons with languages like C/C++.

Sam Altman··Sam Altman

Please Fund More Science

AI summaryThe article argues that the way out of the COVID-19 pandemic lies in science—namely a vaccine, effective treatments, or robust testing and contact tracing—but believes the federal government is not funding enough R&D. It praises the extraordinary speed and focus of biotech companies and research labs responding to the crisis. The author calls on investors and philanthropists to shift their capital toward pandemic-related scientific efforts, both to help end COVID-19 and to prepare for future pandemics.

Josh W. Comeau··Josh W. Comeau

Announcing “use-sound”, a React Hook for Sound Effects

AI summaryThe article announces the release of "use-sound", a React Hook library designed to make adding sound effects to React applications easy. The author argues that the web is a largely visual experience, in contrast to mobile apps which engage sight, sound, and touch through haptic feedback. They encourage developers to consider incorporating audio into their web projects using this new tool.

Eugene Wei··Eugene Wei

My Pandemic Zoom Setup

AI summaryThe author shares their pandemic Zoom setup, recommending two simple gear upgrades for laptop users: a Blue Yeti USB microphone and a Logitech C920S webcam. They emphasize that better audio quality makes the biggest difference, reducing audio fatigue and making calls more pleasant, while the webcam offers a noticeable but less dramatic improvement. Both items are nearly plug-and-play, are Wirecutter's top picks, and the webcam is currently out of stock on Amazon due to pandemic demand.