Paperclip: Image resize options
Paperclip supports ImageMagick resize flags for scaling, cropping, and fitting images to specific dimensions without distorting them.
Escaping of quotation marks in Cucumber steps and step definitions
Quoted text in Cucumber steps can break matching because escaped quotation marks are not handled reliably. Regex steps, capture groups, or Spreewald multiline strings avoid the issue.
sudo command for Windows
Windows lacks a direct sudo equivalent; elevation usually relies on running a shell as Administrator, runas, or third-party tools with limitations.
Ubuntu: Open a new terminal window with a keyboard shortcut
Open a terminal window faster by assigning a custom keyboard shortcut to Ubuntu’s terminal launcher; avoiding clashes with existing app shortcuts prevents conflicts.
Maximum representable value for a Ruby Time object
32-bit Ruby Time values stop at 2038-01-19 03:14:07 UTC; later timestamps raise ArgumentError. DateTime can store later dates but differs from Time and is slower.
How to change MySQL's data directory
Relocating MySQL storage can free space or move databases to another disk, but configuration and AppArmor access must match the new path.
HTML5 and Web Video: Questions for the Industry from the Community
What are Google’s plans for turning WebM into a genuinely open standard, one that is based on consensus like the rest of W3C’s HTML5 effort? Would Google fully support such an effort? Even the WebM project’s domain is controlled by Google. Google chose to release WebM under the Creative Commons license which would theoretically allow a standards body to use the specification as a basis for a truly open standard. Would Google agree to adopt the specification and changes that would emerge from an open process in a timely and robust manner? Wha...
Encrypt files using OpenSSL
Protect files with AES-256 encryption via openssl enc, using a long passphrase file and secure deletion to limit recovery of the original data.
Securely remove files on Linux
rm leaves file data recoverable; shred overwrites files before deletion, while wipe handles directories. Flash storage still needs disk encryption for reliable erasure.
Upgrade from Rails 2.3.10 to Rails 2.3.11
A Rails 2.3.10 to 2.3.11 upgrade can reduce maintenance risk and keep an older application on a supported patch level.
Dump your database with dumple
dumple creates a database dump from a project directory on local machines or application servers, including deployment-time use.
Validate an XML document against an XSD schema with Ruby and Nokogiri
XML files can fail schema checks silently in Ruby; Nokogiri validates documents against XSD and returns syntax errors for reporting.
Continously run command under bash
Sometimes you want to run a command forever, e.g. to compile a haml to html file on the console. Use this:
$ while(true) do haml index.haml index.html; sleep 1.5; done
Cucumber fails without giving error message
Cucumber can fail with little or no visible error output; a backtrace, verbose formatter, or debug mode can expose the underlying cause.
Linux: rename or change extension of multiple files
Bulk file renaming on Linux is error-prone with shell wildcards; Perl rename can change extensions or strip filename prefixes in one command.
Deploy and migrate with a single Capistrano command
Run database migrations during deployment with cap deploy:migrations to restart an application after schema changes, but task hooks can make the sequence unsafe.
Show the description of a Capistrano task
In order to bring up a textual description of a Capistrano task you can say
cap -e taskname
... where taskname is the name of the task you're not sure about.
Auto-hide player controls in the default Flash video player component
Hiding the default Flash video player's controls keeps the skin from staying visible during playback. Set skinAutoHide to true in the component inspector.
Test that a select field contains an option with Cucumber
Cucumber steps can verify that a form select contains or excludes a specific option, without checking the currently selected value.
Fix errors when rendering PDF output
If you run specs or your application and get an error like:
ActionController::MissingFile in 'ProductsController#show, should render PDF'
Cannot read file /some/file.pdf
You may be missing the HTMLDOC binary on your system. Install it like this on Debian/Ubuntu:
sudo apt-get install htmldoc
Show the name and version of your Linux distribution
Get the Linux distribution name and version from release files with a single command.
hyphenator
Javascript that implements client-side hyphenation of HTML-Documents.
remove_index fails silently for non-existing indexes in Rails 2 migrations
When you try to remove a non-existing index using remove_index, the migration will incorrectly pass without an error. The schema will not be changed, but the migration will be considered migrated.
Since this might be fixed in the future, you cannot mend your database by adding another migration on top of the faulty one. You should manually alter the database schema to the previous migration on all machines that migrated the faulty migration (inform your fellow developers), then delete the faulty migration from the repository.
The Case Against Queues
Networked message queues often encourage overengineered systems and operational headaches, adding latency, hidden complexity, and 4AM incidents instead of solving communication problems.