Ruby: Using all? with empty collection
all? returns true on empty collections, which can accidentally match missing associations and lead to unwanted deletions or other false positives.
How to mirror a git repo to a new remote
Move a repository between Git hosts without losing branches, tags, or untracked commits. Mirroring the old remote to the new one keeps the destination in sync.
Capybara: A step for finding images with filename and extension
Capybara step for checking an image by matching part of its src against a filename and extension during browser tests.
How to debug Rails autoloading
Rails constant loading can fail silently in development, especially with threaded code. Logging ActiveSupport::Dependencies helps trace autoloader behavior and diagnose hangs.
PostgreSQL: How to UPDATE multiple attributes with multiple joins
Updating several columns from multiple related tables in PostgreSQL can be awkward without the right UPDATE ... FROM pattern and join conditions.
Sprites with Compass
CSS sprites can reduce image requests by bundling small backgrounds into one sprite; Compass and compass-rails automate sprite generation in Rails apps.
How to query PostgreSQL's json fields from Rails
PostgreSQL json fields store flexible data, but Rails lacks built-in querying sugar. Matching nested values requires manual SQL operators and text extraction.
Font Awesome 5 migration guide
Font Awesome 5 changes icon names and adds fab, far, and fas prefixes; a JavaScript shim can preserve v4 names during migration.
RSpec: How to check that an ActiveRecord relation contains exactly these elements
contain_exactly checks whether an ActiveRecord relation has the expected records, and splatting an AssociationRelation makes the matcher work as intended.
jQuery: How to attach an event handler only once
Prevent duplicate event callbacks in jQuery by using .one() for single-fire handlers or off()/on() with the same function reference.
Ruby: control flow with throw and catch
throw and catch provide a way to exit multiple nested loops early when a result is found, complementing Ruby’s return, break and next flow control.
Form letters with LibreOffice Writer
Create mass letters in LibreOffice Writer by using a spreadsheet as an address source and inserting mail-merge fields; the built-in wizard is unreliable and may crash.
Error during Rails 5 upgrade: Environment data not found in the schema
Rails 5 upgrade can fail when the database schema lacks configured environment data, especially during parallel test database migration.
Remember: LoDash syntax is a bit different from UnderscoreJS
LoDash chaining differs from UnderscoreJS: _ methods may return wrapper objects, and value() ends a chain. The compatibility build can mimic Underscore behavior.
How to find and replace empty cells in Libre Office Calc
Blank spreadsheet cells in LibreOffice Calc are hard to target with normal search; regular expressions let Find & Replace match them reliably.
How to use cookies with curl
Curl sends and stores no cookies by default; -c and -b let you save, reload, or manually supply them for repeated requests.
Rails: Migration helper for inserting records without using models
Safer migration data seeding without loading application models, using a small SQL wrapper for direct row insertion with timestamps.
CSS: Giving text lines a background-color (with configurable line padding and margin)
Multi-line text can have a solid background with adjustable padding and spacing by combining box-shadow, line-height, and box-decoration-break on a wrapped span.
Jasmine: Expecting objects as method invocation arguments
Jasmine spy assertions can match invocation arguments by type, partial object shape, or any value using jasmine.any(), jasmine.objectContaining(), and jasmine.anything().
How to fix HTML elements being cut off when printing
Printed pages can cut off content when CSS layout rules conflict with pagination, especially inline-block, hidden overflow, or fixed positioning.
Jasmine: Mocking API requests in an Angular service spec
Angular service specs can hit real routes unless uiRouter startup is disabled; ngMock and $httpBackend let API requests be intercepted and asserted in Jasmine.
Limitations you should be aware of when Internet Explorer 9 parses CSS files
Internet Explorer 9 can fail on large stylesheets because of hard parser limits: file count, selector count, and nested @import depth.
HTTPie nice command line HTTP client
http is a simple command-line client for debugging and testing HTTP servers, REST APIs, and web services with readable defaults and colored output.