编程 · 最新文章

今日新增 29 篇 · 共 2,698 篇 · 来自 79 个博客

Tailwind CSS Blog·

Building the Tailwind Blog with Next.js

AI 摘要The Tailwind team believes that every project should conclude with an announcement blog post, treating the act of writing as a built-in quality check so nothing is called 'done' until they're comfortable sharing it with the world. However, until now, they had no actual place to publish those posts, which is what prompted them to build their blog using Next.js.

Joel on Software··Joel Spolsky

HASH: a free, online platform for modeling the world

AI 摘要HASH (hash.ai) is a free online platform for building simulations of complex systems where simple math can't capture how inputs affect outputs. Users can write small pieces of code to simulate the behavior of individual entities, such as warehouse workers, and then tweak parameters and rules to observe outcomes. This approach helps people understand and ultimately solve very complicated problems.

Lea Verou··Lea Verou

Refactoring optional chaining into a large codebase: lessons learned

AI 摘要The article recounts the author's experience refactoring the Mavo codebase to use JavaScript's optional chaining operator, describing common patterns to look for (such as &&-guards, ternaries, regex matches, and feature detection) and noting that the refactor made the source about 2KB lighter. However, it also warns about numerous pitfalls, including that optional chaining cannot be used on assignment left-hand sides, that it returns undefined rather than null, that it can subtly change equality checks and operator precedence semantics, and that it can alter control flow in return statements. The author concludes that while optional chaining is a major syntax improvement, refactoring with it requires care to avoid introducing subtle bugs.

Without Boats·

Two Memory Bugs From Ringbahn

AI 摘要While implementing ringbahn, the author introduced at least two memory safety bugs that caused segfaults, allocator aborts, and undefined behavior; both bugs have since been fixed, and no further memory safety issues have been found. The author wrote about these bugs because they shared an interesting common trait: both were caused by destructors.

Without Boats·

Futures and Segmented Stacks

AI 摘要This article discusses how to achieve the best performance from async programs, arguing that async IO gives user programs more control over IO handling than blocking IO. This advantage arises partly from avoiding the inherent cost of context switching between userspace and the kernel, and partly because user programs can be written with more specific understanding of their exact requirements.

Lea Verou··Lea Verou

Hybrid positioning with CSS variables and max()

AI 摘要The article describes a technique for achieving hybrid positioning—where a sidebar navigation scrolls with the page until the header leaves the viewport, then stays fixed—by using a 3-line JS snippet to expose the scroll offset as a --scrolltop CSS variable, combined with the CSS max() function to cap the top position at 0. The author explains why position: sticky doesn't fit this use case, and how the calculation 11rem - var(--scrolltop) * 1px emulates absolute positioning within fixed positioning, with an @supports rule providing a fallback for browsers lacking max() support. An appendix also explains why using the cascade alone for the fallback fails, because invalid values with unsupported functions cause the property to be invalid at computed-value time once CSS variables are involved.

Lea Verou··Lea Verou

New decade, new theme

AI 摘要After nearly a decade with the same blog theme, the author finally redesigned the site after realizing she was avoiding blogging out of embarrassment over how dated it looked. She reflects on how much web technology and her own life changed since designing the old theme, then adapted the WordPress Twenty Twenty default theme with personal tweaks, including animated conic gradients. The new design is a work in progress after just one day's effort, and she invites readers to report any issues.

Without Boats·

Ringbahn: a safe, ergonomic API for io-uring in Rust

AI 摘要The article introduces ringbahn, a prototype Rust crate that provides a safe and ergonomic API for Linux's new io-uring interface. Building on the author's previous post about designing a safe API for io-uring, the crate enables users to perform IO operations without any risk of memory unsafety.

Josh W. Comeau··Josh W. Comeau

Local Testing on an iPhone

Learn how to set up an ideal workflow for debugging your development server on your iPhone. This may not be the most exciting topic I've written about, but it's probably one of the most useful! Keep reading.

Preshing on Programming··Jeff Preshing

A New Cross-Platform Open Source C++ Framework

AI 摘要The author has released Plywood, a cross-platform open source C++ framework extracted from their proprietary Arc80 game engine, which builds and runs on Windows, Linux, and macOS. Plywood is not a game engine itself but a general framework featuring a workspace for sharing code across applications, 36 built-in modules for tasks like platform abstraction and JSON parsing, and a runtime reflection and serialization system. The author plans future improvements such as simplifying module creation, extending the built-in C++ parser, and improving the webserver, and welcomes community feedback.

Travis Downs··Travis Downs

AVX-512 Mask Registers, Again

AI 摘要While examining a high-resolution die shot of Intel's Skylake-X CPU, the author tried to visually locate the physical register files for AVX-512 mask registers and legacy x87/MMX registers, and found that a single mystery block appeared to serve both purposes. Software microbenchmarks using the robsize tool confirmed this theory: mixing MMX and mask register instructions hit the same 128-entry resource limit as testing each alone, while mixing with SIMD or scalar instructions showed a much higher limit, proving mask and x87/MMX registers share one physical register file. This sharing saves die area and power with little practical performance impact, since obsolete x87/MMX code is unlikely to be used alongside AVX-512 mask registers.