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.
Matching elements on complex web pages with Webrat
XPath matchers can be combined with CSS-selector matchers. This is really useful if not, for example, the content of an element should be matched but the element itself like in the following example. Here a form is used to display data as default value in its input elements. This can be the case in web applications in which data should be edited easily without additional clicks.
Enable soft tabs in Vim
Tabs in Vim can be replaced with spaces for consistent indentation across files and platforms, with permanent or temporary settings.
Dump a two-dimensional array to an Excel .xls spreadsheet
Ruby code exports a two-dimensional array to an Excel .xls file with a single method call, with the first row used as a bold header. spreadsheet is required and XLS sheets are limited to 65,535 rows.
Using StaticMatic for static pages
Build static pages with Rails-like comforts such as HAML, SASS, helpers and partials, then compile everything to plain HTML and CSS.
Find records created within a timespan
created_within adds a scope for records created between two timestamps and works on ActiveRecord chains, even when other tables are joined.
Gem Versioning and Bundler: Doing it Right
Running Ruby executables without bundle exec can silently use the wrong gems and break on other machines. Using bundle exec keeps executions tied to the bundle.
Git: How to automatically stage deleted files for commit
Deleted files are not staged by git add .; git add -u updates tracked files and records removals for commit.
Defining host aliases in your SSH config
SSH host aliases in ~/.ssh/config make hard-to-remember servers easier to reach and let you use names instead of raw IP addresses.