Install the SQLite 3 gem for Ruby under Ubuntu
Install the SQLite driver for Ruby on Ubuntu when sqlite3-ruby cannot be used without the SQLite development libraries.
How to fix zero-byte downloads with Rails 3 and Apache / Passenger
Zero-byte downloads in Rails 3 behind Apache/Passenger often come from missing X-Sendfile support, leaving file responses empty.
Test that a string of text is (not) linked in Webrat or Capybara
Cucumber step definitions for asserting whether visible link text is present or absent in Webrat or Capybara using selector-based matchers.
Using Dropbox on Ubuntu
Dropbox can be integrated into Nautilus on Ubuntu for automatic file synchronization without using the web interface. The .deb package installs the client and keeps it updated through an APT source.
Build vs. Buy
Choosing between custom software and a packaged solution depends on whether the supported process is a competitive advantage. Core processes often justify building; others usually fit a standard package better.
How to build the perfect number of blank records for a nested form
Nested forms need enough blank rows for new entries and a sensible minimum total for first-time input; build_nested_records balances both with configurable thresholds.
Force SSH client to use password authentication instead of public key
Password authentication can be tested by forcing SSH to skip public key login and prefer passwords. The same options also work with scp for file copies.
Run Selenium tests in Chrome instead of Firefox
Switching Selenium from Firefox to Chrome requires a matching chromedriver and Capybara driver configuration. Older Capybara versions need a manual Selenium WebDriver setup.
Change the name of your Ubuntu machine
Renaming an Ubuntu machine requires updating /etc/hostname and /etc/hosts; the new hostname takes effect after reboot or with hostname your.hostname.
Linux: Refer to all arguments of a script call
Shell scripts often need to forward every command-line argument without hardcoding positions. $@ expands to all parameters in both sh and bash.
mysqltuner.pl
Perl script for diagnosing MySQL databases and suggesting configuration changes to improve performance.
Hack of the day: A reverse for Rails' &:
Ruby has a reverse of Rails' each(&:method) shorthand for calling an object method with each element: each(&object.method(:call)).
Change the timestamp of a file in Ruby
Set a file's modification time in Ruby with FileUtils.touch; it can create missing files and update multiple paths at once.
See which Rails applications are being served by your Passenger
passenger-memory-stats lists Passenger processes with application directories and memory usage, making it easy to identify which Rails apps are currently served.
Force Google Chrome to run in English on Linux
Google Chrome can inherit a non-English browser language from the Linux locale, which affects sites and Selenium tests. Keeping only en locale files forces Chrome to use English.
What to do when Google only syncs some of your contacts
Google contacts may stop syncing to e-mail clients or phones when they are not in the "My Contacts" group; moving them there restores synchronization.
How to fix: undefined method `specifications' (caused by RubyGems 1.8)
RubyGems 1.8.5 can abort rake tasks with undefined method 'specifications' on /usr/lib/ruby/gems/1.8; a manual patch or version downgrade restores gem path handling.
Sanitize filename with user input
Building filenames from user input can create security issues; a whitelist-based sanitizer replaces unsafe characters and can transliterate Umlauts before saving or downloading.
RubyMine crashes Ubuntu 11.04 window decorator on exit
Java GUI apps can crash Ubuntu 11.04’s window decorator on exit, leaving missing title bars and requiring a temporary restart of the decorator.
How to use helper methods inside a model
Calling view helpers from a model is possible through ApplicationController.helpers, delegation, or a custom proxy when model code needs presentation logic.
Unsafe string methods in Rails
Rails SafeBuffer loses HTML safety after many string transformations, and in-place replacement can raise TypeError; this prevents injection tricks through user input.
markbates/coffeebeans
When CoffeeScript was added to Rails 3.1 they forgot one very important part, the ability to use it when responding to JavaScript (JS) requests!
In Rails 3.1 it’s incredibly easy to build your application’s JavaScript using CoffeeScript, however if you fire off an AJAX request to your application you can only write your response using regular JavaScript and not CoffeeScript, at least until CoffeeBeans came along.
How to use Git on Windows with PuTTY
Use PuTTY's plink.exe and Pageant to make Git work over SSH on Windows, with keys loaded from the tray agent and GIT_SSH set for command-line use.
Using RSpec's late resolving of "let" variables for cleaner specs
Lazy let evaluation keeps RSpec examples shorter when a setup call has many required arguments, and lets stubs change the result before the value is used.