Match a string with wildcards

Convert wildcard-like input into a regular expression for exact matching, escaping metacharacters and treating each character as a flexible placeholder.

How could it be that my database.yml disappears?

database.yml may vanish after a pulled commit deletes it from the repository, leaving local configuration missing.

When the iPad won't play an MP4 video

iPad playback can fail on valid MP4 files even when H.264 settings are correct; some HTTP servers omit headers iOS expects for streaming.

Random numbers in Ruby

Generate random numbers in Ruby under different conditions, including Gaussian and triangular distributions, when simple uniform randomness is not enough.

Plotting graphs in Ruby with Gruff

Ruby charting library for Rails that generates PNG graphs with themes, multiple series, and automatic sizing for large datasets.

Mysterious "margin" below an image

Inline images can leave a small gap below them because they align to the text baseline, reserving space for descenders. vertical-align: middle or display: block removes the gap.

Gimp: Why removing pixels sometimes leaves transparency, sometimes the background color

Deleting pixels in GIMP can either reveal transparency or fill with the background color, depending on whether the layer has an alpha channel.

Use different CSS depending on whether elements render on the same line or multiple lines

Responsive layouts can switch styles when content wraps onto multiple lines or stays on one line, enabling different treatment for narrow screens.

RubyMine: Set specific Ruby version per project

Wrong Ruby interpreter settings in RubyMine cause misleading inspections when a project uses a different Ruby version than the default.

Compress bitmap images within PDF files

PDFs with embedded bitmap images can become large when raster data stays uncompressed; ghostscript or printer compression settings reduce file size when high image quality is unnecessary.

Updated: Saving without callbacks in Rails 3

Rails 3 can now save records without running callbacks, reducing side effects when callbacks should be bypassed.

Sync confidential files between unixes using cloud storage and encfs

Encrypted file sync across Unix machines keeps confidential documents in cloud storage while encfs protects the contents from the provider.

Fix capistrano errors: "no such file to load -- net/ssh/authentication/agent/socket" or "uninitialized constant Net::SSH::KnownHosts::SUPPORTED_TYPE"

Capistrano can fail with net/ssh load errors or an Net::SSH::KnownHosts::SUPPORTED_TYPE constant error when paired with net-ssh 2.5.1. Upgrading to 2.5.2 restores compatibility.

MySQL 5.1: Switch to InnoDB Plugin for better performance

MySQL 5.1 can use the faster InnoDB Plugin instead of the built-in engine, improving performance without changing the file format.

Removing white space after links in HAML

Haml inserts unwanted spaces around inline links, leaving punctuation separated from the anchor. Several workarounds avoid the gap without adding a helper.

Howto properly use vertical-align to align elements vertically

Vertical centering with vertical-align depends on inherited line-height, and works reliably only when the container height is at least that value.

When using time zones, beginning_of_day / end_of_day is broken in Rails 2 for any Date or DateTime

beginning_of_day and end_of_day on Date and DateTime ignore Rails 2 time zones, so database queries can hit the wrong records.

Rails 3 routing: Be careful with matching routes *including their format*

Routing a dotted path can break Rails format detection, leaving format as html despite an XML constraint. Matching the route without the extension preserves the intended xml format.

Get Rid of That Code Smell – Duplication

Removing duplication often means finding repeated concepts rather than identical lines, since similar code can hide different intent and reuse can create false matches.

Aspect Oriented Programming in Ruby

Integrating cross-cutting concerns in Ruby can reduce duplication and keep logging, security, and other shared behavior separate from core business logic.

How to find out Your Ubuntu / Debian Linux is 32 bit or 64 bit

Checking whether an Ubuntu or Debian system is 32-bit or 64-bit helps match software and troubleshoot compatibility. uname -m reveals the machine architecture.

Fix error: can’t find executable rails

Rails fails to start when the rails executable points at a missing or half-installed gem set, often after an RVM mismatch or interrupted install.

Three quick Rails console tips

Rails console sessions can exercise routes, requests, and helpers without running the full app in a browser.