Wrapping Your API In A Custom Ruby Gem
Packaging API bindings as a custom Ruby gem makes reuse and distribution easier, with tests recording HTTP interactions through VCR.
How to fix: Font too small when reading e-mails in Thunderbird
Plain-text e-mails in Thunderbird can ignore custom font settings because fonts are stored per character encoding, so some messages still appear tiny or default.
Backup an entire website using wget
Copying a whole website for offline browsing is simple with wget; recursive fetching and link conversion make local viewing possible.
pdfkit/wkhtmltopdf: When a header is invisible
header_html and footer_html can stay invisible in PDFKit and wkhtmltopdf unless the header or footer HTML starts with <!doctype html>.
Eager-loading polymorphic associations
Polymorphic eager loading avoids n+1 queries, but includes can fail when ordering or filtering on joined tables; explicit joins or preload keep loading efficient.
Rails 4.1+: New locale files require a Spring restart
Rails 4.1 development can ignore newly added I18n YAML files because Spring caches the load path; restarting Spring makes new translations appear.
Pete Hunt: React - Rethinking Best Practices
React.js shifts UI development toward reusable components and declarative rendering, reducing the complexity of manual DOM updates.
Use a Bash function to alias the rake command to Spring binstubs or "bundle exec" fallback
A Bash function can route rake to bin/rake when Spring binstubs exist, otherwise to bundle exec rake, speeding Rails 4.1+ and avoiding version conflicts on older apps.
Linux: Running a program with a different locale than your default
Run a command with a different locale when scripts or output parsing need English labels or predictable text. LC_ALL, LANG, and locale -a control and list available locales.
How Exchange handles multipart/alternative emails
Exchange can discard the plaintext part of multipart/alternative email, leaving only HTML in normal mail accounts and complicating debugging.
Change the existing order of an ActiveRecord scope
reorder replaces an existing order clause in an ActiveRecord relation, making it easy to change sort order without rebuilding the query.
The Curious Case of the Flip-Flop
Ruby’s flip-flop operator is obscure and rarely useful, often adding confusion rather than clarity. Recognizing it helps when reading unfamiliar code.
Using rbenv on Ubuntu 18.04+
Set up rbenv on Ubuntu 18.04+ with custom plugins and build dependencies to manage multiple Ruby versions reliably.
Perform Sidekiq jobs immediately in development
Run Sidekiq jobs synchronously in development to avoid a separate worker process and benefit from code reloading.
RSpec example groups can be named using symbols
RSpec example groups and shared examples can use symbols as names, even though the official docs do not mention it.
Using the Facebook Graph API
Server-to-server access to the Facebook Graph API can use an app token instead of OAuth; some resources still require a user-authenticated request.
Upgrade to LibreOffice 5.x on Ubuntu
Upgrade Ubuntu to LibreOffice 5.x by removing old packages and obsolete PPAs, then installing the newer release and optional language or GTK support.
Git: Diff per word or character
git diff normally compares whole lines; --color-words and --color-words=. provide word or character level change highlighting for finer review.
Ubuntu: Fix "An error occurred while installing pg"
pg gem installation on Ubuntu can fail when PostgreSQL development headers are missing; installing libpq-dev restores Bundler installs.
Paperdragon: Explicit Image Processing
File attachment handling for images without automatic framework integration, useful when explicit processing and storage control are preferred.
Openstack: Create a Flavor
Create and list OpenStack Nova flavors by defining RAM, disk, swap, and vCPU resources for instances.
Why Most Freelancers Set Their Clients Up For Failure (And How To Fix This)
Freelancers can damage client outcomes when short-term task delivery overrides business goals and continuity. Aligning work with the client’s larger needs reduces preventable failure.
Rails routes: Extracting collection actions into their own controllers
Rails routing can make singleton collection pages awkward to place under a namespace without adding :project_id; custom controller paths or namespace/resource combinations keep URLs and controllers aligned.
Rspec: Complex argument expectations for should_receive
Tight should_receive(...).with(...) expectations on hashes are brittle and produce unreadable failures. Block-based argument checks keep RSpec assertions clearer and more flexible.