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.
Capistrano 2: How to deploy a single server
Deploy a single server from a multi-server Capistrano setup by using HOSTFILTER to target one host and skip irrelevant tasks.
Ubuntu: keyring password won't change with user password
Ubuntu keyring passwords can differ from the current user password after later password changes. If the old password is unknown, the affected keyring may need to be deleted in Passwords and Keys (seahorse).
Testing webpages globally (as in "around the globe")
Global website checks reveal DNS propagation issues and location-specific rendering problems before users do.
How to define height of a div as percentage of its variable width
Percentage padding-top can create a responsive box whose height follows its width, useful for keeping background images proportional without fixed heights.
Webmock's hash_including doesn't parse query values to string
hash_including in WebMock v3.0.1 compares query values as strings, so integer expectations fail unless the request matcher uses '1' instead of 1.
Listing all gems on a private gem server
gem list -r --clear-sources -s can inspect gems on a private remote server, useful when Bundler reports a gem in multiple sources.
Standard Gems
Ruby's standard library is being gemified, so components can be updated independently of Ruby and API breaks can be fixed before a full Ruby upgrade.
HTTP/2 push is tougher than I thought - JakeArchibald.com
Browser HTTP/2 push support is inconsistent and can hurt performance instead of improving it, despite a useful model for integrating push with browser APIs.
RSpec: Stubbing a method that takes a block
RSpec stubs for methods that yield blocks need and_yield instead of and_return; multiple yields can be chained, and return values can be combined.
Middleman: Use pretty URLs without doubling requests
Middleman pretty URLs can trigger an extra redirect and second page request; Apache can serve /foo/index.html directly while canonicalizing /foo/.
Middleman configuration for Rails Developers
Rails-friendly Middleman setup for live reload, asset pipeline, i18n, environment-specific config, browser testing, and Capistrano deployment.
Capistrano 3: How to deploy when a firewall blocks your git repo
Firewall or proxy settings can block Capistrano from reaching a Git repository and stop deployments. Using an HTTP proxy or an SSH tunnel restores repository access.
Quickly printing data in columns on your Ruby console
Print Ruby objects in aligned columns in the console for quick record comparison and attribute inspection.
Git: undo delete
Restore a deleted or removed file in Git and undo a staged deletion without committing, using the index and git checkout -- correctly.
Howto: Require a gem that is not in Gemfile
LoadError occurs when a Ruby gem is required outside Gemfile or .gemspec; adding its install path to $: allows temporary loading for debugging.
Rubymine provides a visual merge conflict resolution tool
Resolve Git merge conflicts locally in RubyMine with a visual three-pane tool for comparing versions and choosing changes.
How to use your iPhone's internet connection on your Ubuntu machine via USB
Use an iPhone’s cellular data connection on Ubuntu over USB by installing iPhone tethering packages and enabling Personal Hotspot.