Regular Expressions: Quantifier modes

Greedy, lazy, and possessive quantifiers change regex matching behavior and performance; poor choices can trigger heavy backtracking or even denial-of-service bugs.

Rails: Comparison of assignable_values and Active Record enum types

Rails enum attributes store states as integers or database enums, with validation and generated scopes; assignable_values still offers conditional rules, associations, and array support.

Ruby: Following redirects with the http gem ("httprb")

Automatically following HTTP redirects with http is optional and limited by max_hops; redirect loops raise an error.

ActiveRecord: String and text fields should always validate their length

String and text columns need model length validation to prevent database exhaustion and avoid runtime SQL errors on oversized input.

Test your application's e-mail spam scoring with mail-tester.com

Check outbound mail for spam filters and deliverability issues with mail-tester.com; a score around 9/10 is usually fine, while plain-text bodies and proper DNS help avoid false positives.

Insomnia helps you querying your API

GUI client for testing and communicating with APIs; a less cluttered alternative to Postman and cURL, available via snap or Ubuntu packages.

Postgres: DISTINCT ON lets you select only one record per ordered attribute(s) for each group

PostgreSQL DISTINCT ON keeps one ordered row per group, useful for latest-per-user queries and other group-wise maximum results when plain DISTINCT is not enough.

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.

Ruby: Don't build randomness into your factories

Random values in factories and Faker data make specs flaky and hard to debug. Fixed values or deterministic sequences keep test data stable.

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.