What’s Up With All These Changes in Rails?
Yesterday, there was a blog post entitled “What the Hell is Happening to Rails” that stayed at the number one spot on Hacker News for quite a while. The post and many (but not most) the comments on the post reflect deep-seated concern about the recent direction of Rails. Others have addressed the core question about change in the framework, but I’d like to address questions about specific changes that came up in the post and comments.
Unpack a .tar.gz archive
tar archives compressed with gzip can be unpacked in the current directory with -xzf; the same command style also applies to other tar formats.
Order in which RSpec processes .rb files
RSpec file loading order affects test stability only when examples depend on global state; version defaults differ between alphabetical, disk, and random execution.
Stubbed class methods in RSpec 1 remain stubbed in other examples
RSpec 1.x can leave stubbed class methods in place between examples, causing order-dependent failures when spec file evaluation changes.
New Cucumber Factory makes it easier to associate records
Cucumber Factory now links records by any string attribute, reducing the need to assign explicit names when reusing previously created objects in feature scenarios.
15 criteria for evaluating software product ideas
Choosing the right product to develop is crucial. Great execution is also very important. But if you develop a product that no-one wants or no-one is prepared to pay for, then you are going to fail, no matter how well you execute it. You can often tweak a product or its marketing to make it more successful based on market feedback (‘pivot’) . But the less pivoting you have to do, the better. Below I list some of the criteria I think are important for evaluating the potential of new commercial software products.
Example .ssh/config file
A reusable ~/.ssh/config template can simplify SSH access with host aliases and keepalive settings, then be adapted to personal needs.
A nicer way to run RSpec and/or Cucumber
Convenience scripts streamline RSpec and Cucumber runs with bundle exec, parallel execution, spinner support, and a full test check against regressions.
Don't forget to add ":dependent => :destroy" for join models
Join records can be left behind when parent records are deleted, causing orphaned data and inconsistent associations. :dependent => :destroy removes them automatically.
Dynamically skip Capistrano hooks
Avoid repeated remote database dumps during Capistrano deployments by skipping the db:dump hook with a deploy flag or environment variable.
Mark up text in Balsamiq Mockups
Inline markup in Balsamiq Mockups adds bold, italic, and hyperlink styling to editable text; bold often looks unchanged because many widgets already use bold fonts.
How to: Classic scrollbars in Ubuntu 11.04
Ubuntu Natty's hidden GTK scrollbars can be removed when classic scrollbars are preferred. Purging liboverlay-scrollbar-* restores the old behavior after restarting apps or logging in again.
Files open with an error "the location is not a folder" after installing XFCE
Files and browser downloads may fail to open after installing XFCE because exo-utils conflicts with gnome-open; removing the package resolves the folder-location error.
Commonly used regular expressions - Cheatsheet
Common validation patterns for host names, German bank data, postal codes, hex colors and IPv4 addresses, plus reusable constants in a Pattern class.
Fixing: no sound on front audio in Ubuntu 11.04
Front audio output can stay silent while the mic works because a separate headphone path is enabled. Changing the audio mixer setting restores all outputs.
Printing to PDF files on Ubuntu
Create a virtual printer that saves print jobs as PDF files on Ubuntu, with output written automatically to ~/PDF/.
List directories ordered by size (with human-readable output)
Find the largest or smallest directories in a tree by combining du with sort -h for human-readable size ordering.
How to test resource_controller hooks
Testing resource_controller callbacks directly avoids triggering the action path and verifies hook behavior in controller specs.
Check apache config files' syntax
Validate Apache configuration syntax with apache2ctl configtest or apache2ctl -t; passing checks do not guarantee a successful server start.
SSL: Build a Certificate signing request (CSR)
Creating a CSR and private key for an SSL certificate requires careful server-side generation; the common name must match the domain exactly or the certificate becomes invalid.
Soft-scroll to an anchor with jQuery
Links with anchor targets can jump abruptly; jQuery animation creates smooth scrolling to the destination and can preserve the URL hash.
Semantic markup standard for search engines
Structured data on web pages helps search engines display richer results for people looking for contact details, places, events, or products.
Alternative to #to_a and Array(...)
Turning arbitrary values into arrays can trigger to_a deprecation warnings and inconsistent nil behavior. Array.wrap or listify provide a safer conversion.
Open a new tab with the current directory on a mac
Open a new Terminal tab in the current directory and optionally run a command there using a simple tab script.