GitLab: Git alias for creating a merge request on push
A Git alias can push a branch to GitLab and create a draft merge request automatically, with an optional target branch override.
Chrome DevTools: Quick Bite - Store Element in Global Variable
Chrome DevTools can store a selected DOM element as a global variable for quick inspection and reuse in the console.
ActiveType::Object: Be careful when overriding the initialize method
Overriding initialize in ActiveType::Object can break ActiveRecord-style setup, freeze instances, or cause argument errors unless super is called with one attribute hash.
Temporary solution for connection errors with rubygems
Bundler can fail to fetch gems from rubygems.org when IPv6 connectivity is broken. Lowering IPv6 priority in /etc/gai.conf can let bundle install succeed temporarily.
Debug flaky tests with an Unpoly observeDelay
Flaky integration tests can outrun watchInputDelay, causing Unpoly field updates to overwrite typed input before requests start. Lowering the delay or signaling CapybaraLockstep reduces failures.
Rails: Validations of Dates, Numerics and Strings with ComparisonValidator
Rails 7+ validates dates, numbers and strings with ComparisonValidator for greater-than and less-than checks, replacing custom comparison code.
How to emulate simple classes with plain JavaScript
Class-like objects with private state and public methods in plain JavaScript can run in any browser without this, prototypes, CoffeeScript, or Babel.
Whitelist Carrierwave attributes correctly
Strong Parameters for CarrierWave uploads need more than the file field; cache and removal flags keep images across validation errors and enable deletion.
Git: Switch
Safer branch navigation in Git benefits from git switch, a clearer alternative to git checkout for changing, creating, and detaching branches.
Exploring the disk usage with ncdu
Finds large files and directories consuming disk space on servers or minimal systems with a text-based interface.
You can implement basic object-fit behavior with background images
Need object-fit behavior with Internet Explorer support: background-size: contain or cover can mimic image fitting and cropping in IE9+.
In MySQL, a zero number equals any string
MySQL treats 0 = 'any string' as true, so mixed string-integer comparisons can match unexpected rows and bypass indexes; PostgreSQL rejects such comparisons.
A community-curated list of flexbox issues and cross-browser workarounds for them
Flexbox can behave differently across browsers, and layout bugs often need known workarounds. A community list collects reported issues and fixes for broken responsive layouts.
How to fix "Exit with code 1 due to network error: ProtocolUnknownError" with wkhtmltopdf
wkhtmltopdf can fail with ProtocolUnknownError when file:// URLs are blocked by default, preventing local assets such as stylesheets from loading.
SEO: The subtle differences of robots.txt disallow vs meta robots no-index
robots.txt can block crawling without removing URLs from search results, while noindex removes accessible pages from indexing. Disallowed URLs may still appear as search matches.
Do not use "flex: 1" or "flex-basis: 0" inside "flex-direction: column" when you need to support IE11
IE11 miscomputes flex: 1 in column flex containers because it implies flex-basis: 0, causing overlapping children; flex: 1 1 auto works reliably.
Prefer using Dir.mktmpdir when dealing with temporary directories in Ruby
Unique scratch directories prevent flaky tests and stale files in parallel Ruby test runs. Dir.mktmpdir creates them safely and can use a custom base path.
How to get the git history of a file that does not exist anymore
Recover the change history of a deleted file in Git by using git log with history-preserving flags across all references.
Rails: Comparison of Dates - before? and after?
Rails 6+ adds before? and after? for comparing dates and times; between? checks whether a value falls within a range.
Ruby and Rails: Debugging a Memory Leak
Growing memory usage in Ruby and Rails can exhaust a process and cause crashes; ObjectSpace.count_objects helps identify leaking object types, and derailed_benchmarks can aid diagnosis.
Rails: Custom validator for "only one of these" (XOR) presence validation
Rails models often need exactly one of several attributes filled in; built-in validations do not handle this XOR case cleanly. A custom ActiveModel::Validator can enforce blank-or-singleton presence with clear errors.
Converting SVG to other vector formats without Inkscape
Convert SVG files to PS, PDF, or EPS without Inkscape using CairoSVG and ps2eps; it is lightweight, fast, and works from files or stdin.
A simpler default controller implementation
Rails controllers can stay short, testable and authorization-friendly by using a minimal shared blueprint for CRUD, strong params, scopes and optional HTTP caching.
Updated: Git: removing feature branch on merge
@{-1} resolves to the previous branch name, including when git merge - uses the last checked-out branch.