Rails 8 provides a new way of doing things after the current transaction, without defining a model "global" after_commit...

flex-wrap: balance is like flex-wrap: wrap, but it balances rows to be roughly the same width.

TL;DR: Pannellum is a small (~56 kB, own WebGL renderer, no three.js) equirectangular panorama viewer. The npm package has...

The Performance Navigation Timing API allows reading how the current document was loaded. All major browsers support it. Usage

Dealing with exceptions in a Rails application is (surprisingly) complex. There are multiple configurations and methods that influence how exceptions...

The sandbox in Claude Code by default can access files anywhere in your home directory. This is not ideal, since...

makandra dev

By default, Claude Code runs commands through its Bash tool as your user. While this works, you will likely encounter...

makandracards.com

Added an example and removed the redundant before_destroy.

makandra dev

Compromised npm packages have become a weekly occurrence. This is being accelerated by AI tools that find and exploit vulnerabilities...

Concurrent counter increments are a race-condition trap. The Rails idiom (load the record, increment in Ruby, save) breaks under...

In tests you can write users(:alice) to look up a fixture record. The same helper is not available in...

When deletion of a parent record should be blocked by one or more conditions on the same child table, declare...

makandra dev

Hybrid search runs a vector query and a keyword query in parallel against the same documents and merges the two...

makandra dev

Getting parseable output back from an LLM has two halves: shaping the request, then parsing the response. Even with Ollama...

RAG is often equated with vector databases, embeddings, and semantic search. But RAG ("Retrieval-Augmented Generation") really is just 'put...

When an LLM is part of a request, you want to keep track of how much of the runtime was...

makandra dev

When an LLM model has vision capabilities, you can attach Base64-encoded images to chat messages, and it will load...

Rails offers several ways to remove records. They differ in whether they instantiate records, fire callbacks (including dependent: associations) and...

Below is a strict, but still workable Content Security Policy for your Ruby on Rails project. Use this CSP if...

api.rubyonrails.org

When working with file uploads, we sometimes need to process intrinsic properties like the page count or page dimensions of...

I recently encountered this error as I was trying to build assets: $ node esbuild.config.js .../node_modules/esbuild-plugin-browserslist/dist/resolveToEsbuildTarget.js:43 throw new Error('Could...

Postgres supports multiple built-in range datatypes: int4range int8range numrange tsrange (range with timestamp without timezone) tstzrange (range with timestamp...

TypeScript basically uses structural typing, which is conceptually quite similar to duck typing, but with static compile-time type checking...

Leaving old unused DB columns around after a migration is confusing for other developers. However, dropping columns too eagerly might...