IRB: last return value

IRB and the Rails console store the previous command result in _, making it easy to reuse a forgotten value without rerunning the expression.

ImageMagick: How to auto-crop and/or resize an image into a box

ImageMagick can remove transparent borders and fit images into a fixed box without distortion. -trim, -resize, and -extent preserve aspect ratio and center the result.

RSpec's hash_including matcher does not support nesting

hash_including cannot match nested hashes reliably; use nested matchers such as include or another hash_including for partial hash checks.

Know what makes your browser pant

Changing CSS properties can trigger different amounts of browser work, affecting performance when styles are updated.

ActiveRecord::RecordNotFound errors allow you to query the :name and :id of the model that could not be found

ActiveRecord::RecordNotFound carries model and id, making it possible to report missing records without exposing internal query details.

Rails: wrap_parameters for your API

Rails can nest flat JSON request bodies under a root key so strong parameters work like form submissions and stray keys such as format stop interfering.

Rails: Configure ActionController to raise when strong params are invalid

Raise controller errors for unexpected request parameters in Rails APIs, letting invalid payloads surface as ActionController::UnpermittedParameters and ActionController::ParameterMissing.

How to: Snom 300 firmware update

Updating Snom 300 firmware through the phone’s web interface requires the correct version link from the Snom wiki; the firmware field accepts pasted URLs despite appearing disabled.

Snom 300 with headset: Unlink ringtone volume from headset volume

The Snom 300 can tie headset and ringtone volume together when the ringer output setting is misconfigured. Selecting only one output device separates the volumes.

Ubuntu: Share internet connections with other computers

Set up an Ubuntu computer as a gateway to share one internet connection over a local network, including WLAN or tethering sources.

How to make select2 use a Bootstrap 4 theme

Select2 can be styled to match Bootstrap 4, using a Bootstrap 4 theme fork and matching Sass imports for consistent dropdown controls.

Capistrano: Doing things on rollback

Capistrano rollback hooks let custom deployment tasks undo side effects after a failed release, including Slack notifications and other deployment-specific actions.

How to make Webpacker compile once for parallel tests, and only if necessary

Compile Webpacker assets once in parallel test runs and skip recompilation when files are unchanged, avoiding duplicate work and Capybara timeouts.

Cucumber: Test that an element is not overshadowed by another element

Detects whether a visible page element is covered by another layer, such as a modal overlay or higher z-index element, using a browser hit test.

Caution: Carrierwave has your file three times (temporarily)

CarrierWave can temporarily keep three copies of an uploaded file, and large uploads may waste time and disk space. Configuring moves instead of copies reduces the duplication.

Ruby: define a class with Struct.new

Struct.new can define lightweight Ruby classes with attributes, comparison, and keyword initialization for data objects that behave more like records than hashes.

How to: Rails cache for individual rspec tests

Rails caching can be enabled for a single RSpec example without changing global test settings. File and memory stores let cache behavior be verified in isolated tests, including parallel runs.

Speed up better_errors

Better Errors can become very slow in development when large objects are inspected and rendered. Limiting huge inspect output improves error-page performance.

Shoulda Matchers: how to test conditional validations

Conditional Rails validations with if: are not covered by Shoulda Matchers; test the model’s behavior by stubbing the predicate and checking presence only when it applies.

RawGit

Serve raw GitHub files with correct Content-Type headers for CDN-style testing or prototyping, but without any uptime guarantee.

MySQL 5.7.5 enables `ONLY_FULL_GROUP_BY` mode per default

ONLY_FULL_GROUP_BY in MySQL 5.7 rejects queries that select non-grouped columns, preventing nondeterministic results and breaking some Rails scopes.

PostgreSQL: How to add/remove/modify array values (and how to replace 1 value with multiple values)

Manipulating PostgreSQL array columns can be awkward: values can be appended, removed, or replaced, with special handling for multi-value substitutions.

Clicking issues with chromedriver

ChromeDriver click targeting can hit the wrong point on an element, causing intercepted or non-clickable errors when overlays or nearby elements overlap.

Rails 5's ApplicationRecord is the place to put generic model logic

Rails 5 model classes inherit from ApplicationRecord, making it the shared home for logic used by all application models instead of patching ActiveRecord::Base.