Invoices: How to properly round and calculate totals

Invoice totals can miss cents when rounding is done too late or with floats; rounded item totals and BigDecimal keep net, VAT and gross consistent.

How to negate scope conditions in Rails

Finding the opposite of an ActiveRecord scope is tricky with NULL values and older Rails versions; invert_where, subqueries, or Arel can negate conditions safely.

MySQL: Careful when using database locks in transactions

MySQL snapshot reads in REPEATABLE READ can hide concurrent changes, so counts and updates drift unless locking starts before the first query.

Rails: Different flavors of concatting HTML safe strings in helpers

Different ways to build HTML-safe markup in Rails helpers affect readability, buffering, and XSS safety. concat, safe_join, capture, and html_safe each behave differently.

Don't build randomness into your factories

Random values in factories make tests flaky and hide failures; fixed defaults and sequences keep test data predictable.

The Self-Contained Test

Shared test setup makes example files harder to read and change; self-contained examples keep tests clearer and easier to extend.

Ruby: Making your regular expressions more readable with /x and alternative delimiters

Complex Ruby regular expressions become easier to read with %r alternative delimiters and the /x flag for whitespace and comments.

Text column sizes in MySQL

MySQL text fields use four storage sizes with byte limits, and limit maps to the smallest fitting type. Choosing the wrong size can waste space or truncate data.

Understanding database cleaning strategies in tests

Test databases need cleanup between examples to keep state isolated; transactions are fastest, while browser-driven tests or MyISAM tables require deletion or truncation.

Using regular expressions in JavaScript

Regular expressions in JavaScript use RegExp objects or regex literals, and global matches keep state between test() calls.

Migrating from Elasticsearch to Opensearch: Overview

Elasticsearch licensing changes force a move to OpenSearch, with parallel clusters and reindexing to preserve search service continuity.

How to handle when an HTML <video> element cannot autoplay

HTML video autoplay can fail on page load or without user interaction, and there is no native failure event. Checking paused after media loads reveals whether playback started.

Using rack-mini-profiler (with Unpoly)

Rails performance debugging often hides slow SQL, view rendering, and N+1 queries; rack-mini-profiler helps surface bottlenecks during development.

SAML Single Logout (SLO)

SAML logout can be initiated by the service provider or identity provider, with browser redirects or backchannel POSTs; devise_saml_authenticatable needs specific Rails and Keycloak logout handling.

Rails 7.1: Take care of the new production log default to standard out

Rails 7.1 changes production logging to standard out, which can break file-based logs in opscomplete setups unless the previous logger configuration is restored.

Caution: rem in @media query definitions ignore your font-size

rem breakpoints in @media queries can ignore a set root font size and shift at the browser default instead, causing unexpected responsive behavior.

Problems with git submodules in Gitlab CI

Git submodules in GitLab CI can fail with permission errors when cloning private repositories into other projects. Access restrictions on CI token usage must be loosened or allowlisted.

Canceling promises

Async functions can be made cancelable with AbortSignal and AbortController; rejecting with AbortError matches browser APIs and improves compatibility.

Cucumber's table diffing does not play nice with Spreewald's `patiently do`

Cucumber::MultilineArgument::DataTable#diff! caches state, so repeated checks inside patiently do keep failing; expected_table.dup.diff! avoids the stale comparison.

Debug SAML in development using a local keycloak server

Local Keycloak can emulate a SAML identity provider for development, letting SSO flows and attribute mapping be tested without waiting on an external IDP.

Ruby: How to connect to a host with expired SSL certificate

HTTPS requests to hosts with an expired certificate can stay safe by accepting only one known certificate instead of disabling verification entirely.

Your Cronjobs should not rely on a perfect schedule

Cron jobs can miss their scheduled run because of network or hardware failures, so recurring work should resume safely after delays by tracking the last successful execution.

Stretching an HTML page to full height

html and body default to content height, so absolutely positioned footer elements may miss the viewport bottom; min-height: 100% or 100vh keeps pages full height.

Ruby's percent notation can do more than strings

Ruby percent notation creates symbols, arrays, regexes and shell output with compact literals and interpolation support.