How to install a current version of git to your Ubuntu machine

Ubuntu ships an older git release by default; adding the Git Core PPA and installing from apt provides a newer version.

Understanding Scope in Ruby

Ruby scope determines which variables, constants, and methods are visible at a given point, helping prevent confusion about what can be accessed in different contexts.

JavaScript: Polyfill native Promise API with jQuery Deferreds

Small Promise polyfill for jQuery projects, trading native API compatibility for tiny size and jQuery Deferred performance limits.

murdho/rack-cargo: Batch requests for Rack APIs

Single /batch requests reduce API round trips and let later calls reuse earlier results through named placeholders.

travisliu/traim: Resource-oriented microframework for RESTful APIs

Build a RESTful API for ActiveRecord models with very little code. Traim emits a Rack application that can run standalone or inside Rails, but the 1:1 resource model can become limiting.

Deleting stale Paperclip attachment styles from the server

Unused Paperclip image style files can accumulate on the server after style changes, wasting storage and cluttering attachment directories.

ActiveRecord: How to use ActiveRecord standalone within a Ruby script

Run ActiveRecord without Rails in a tiny Ruby script to reproduce bugs or test associations with an in-memory SQLite database.

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.