Limiting GitLab CI runner to specific branches or events

Control when CI jobs run by matching branches, merge requests, and other pipeline conditions with rules; rules replaces only and except in GitLab 12.3+.

Bundler: Packaging gems into the git repository (offline installation)

Offline gem installation with Bundler requires checking dependencies into the repository and configuring local paths for bundle install without rubygems.org access.

How to generate and test a htpasswd password hash

Create and verify bcrypt password hashes for Apache authentication, with safer handling than command-line password entry.

Emulating document.currentScript in old browsers

document.currentScript is missing in older browsers, making it hard to read a running <script> element’s attributes or nearby DOM. A simple document.scripts fallback works only for non-async scripts.

Capistrano: Deployment issue undefined method `[]' for nil:NilClass

Newer Passenger versions change passenger -v output, breaking capistrano-passenger version parsing and causing undefined method '[]' for nil:NilClass during deployment.

Converting ES6 to ES5 on the command line

Transpiling ES6 JavaScript to ES5 on the command line can produce a smaller output with tsc, but missing APIs still need polyfills.

RubyMine: How to restore the Back to last position shortcut on Ubuntu 20.04

RubyMine navigation shortcuts can stop working on Ubuntu 20.04 because GNOME steals Ctrl+Alt+Arrow Left/Right for workspace switching. Switching to the default GNOME keymap restores back/forward navigation.

Ruby: How to convert hex color codes to rgb or rgba

Convert hex color codes to RGB or rgba values in plain Ruby, including 3-, 6- and 8-digit forms with optional opacity.

Rails 4 introduced collection_check_boxes

Rails 4.0 adds collection_check_boxes for rendering checkbox groups from a collection and handling multi-value form params safely.

Online tool to convert tables between different formats

Online table conversion helps move data between JSON, Markdown and CSV, with transpose support for rotated tables. Not suitable for sensitive data.

Capybara: Preventing headless Chrome from freezing your test suite

Headless Chrome can freeze end-to-end test runs and leave Capybara waiting through long timeouts; restarting sessions regularly and failing fast on lost browser communication reduces hangs.

Capybara: Pretending to interact with the document

Browsers block autoplay and popup APIs until a user gesture occurs; a tiny clicked element can unlock them in Capybara tests.

RSpec: How to test the content of a flash message in a request spec

Rails request specs can verify flash messages in the response, letting controller updates surface user feedback such as success or alert notices.

makandra/capybara-lockstep

Flaky end-to-end tests often fail because Capybara outpaces client-side JavaScript and AJAX; synchronizing commands with browser activity makes full-stack integration suites more stable.

Ruby: Generating and parsing JSON, or: understanding JSON::ParserError "unexpected token"

JSON.parse rejects JSON values produced by to_json for non-Hash and non-Array objects; JSON.generate pairs with JSON.parse, while JSON.load restores Ruby objects and should not handle untrusted input.

Geordi 5.4.0 released

Geordi 5.4.0 adds geordi branch, MySQL dump speedups, Pivotal Tracker ID support in global config, and fixes for dump load requirements and test processor documentation.

Parsing JSON with edge cases

Ruby json accepts duplicate keys by keeping the last value, tolerates comment-like truncation in some cases, and can decode huge exponents to Infinity.

Webmock < 3.12.1 cannot handle IPv6 addresses correctly

WebMock fails on IPv6 URLs because addresses need brackets before the port, causing invalid URI and port parsing errors in CarrierWave and SsrfFilter.

Making ZSH the default shell on Ubuntu 20.04

ZSH can replace Bash on Ubuntu 20.04 and adds command-line conveniences like completion, corrections, themes, and plugins.

Mixed Content Examples

Mixed content behavior differs when secure pages load assets over HTTPS versus HTTP, exposing browser handling of blocked or downgraded resources.

Rails: Parsing a time in a desired timezone

Create a Time in a fixed timezone regardless of Rails or system settings; useful for tests and API date comparisons when parsing otherwise shifts by environment.

How to fix: WrongScopeError when using rspec_rails with Rails 6.1

rspec_rails with Rails 6.1 can raise WrongScopeError; upgrading the gem to 4.0.1 or later resolves the failure.

Best practices for REST API design

REST API design often fails on timestamps, number handling, pagination, filtering, and versioning. Consistent conventions improve interoperability and client stability.

Running old ImageMagick versions in a Docker container

Legacy ImageMagick installs can be kept available when the system package is unavailable by running convert and related tools in a Docker container with absolute paths.