Sudo a gem executable does not work on Ubuntu

sudo cannot find Ruby gem executables on Ubuntu because gem binaries live outside its secure path; symlinks, a different bindir, or changing secure_path work around it.

Getting started with Chef

Chef setup depends on curl, sudo access to gems, and running commands inside the chef-repo directory to keep configuration files available.

Fix randomly failing PDF cucumber tests

PDF Cucumber tests can fail intermittently on the first run when generation is not ready. A readiness step waits for PDF output before checking contents.

Remove carriage returns from DOS-formatted text files using Vim

DOS-formatted text files can contain carriage return characters that break Unix tools and line handling. Vim can rewrite them with Unix line endings.

Script to open an SSH shell to a Capistrano deployment target

Need an SSH shell on a Capistrano target without guessing deploy user or directory; shell-for parses config/deploy and can run remote commands before opening bash.

Protect your Mac

Mac data security can be improved by encrypting the drive and Time Machine backups with PGP Whole Disk Encryption.

Conditional comments for Internet Explorer with Haml

IE conditional comments can target specific browser versions, and Haml supports them directly; semi-conditional HTML still requires an :erb section.

Getting started with Puppet

Puppet helps learn and manage configuration automation through a virtual machine and basic setup on Ubuntu or Mac OS X.

Matching line feeds with regular expressions works differently in every language

Dot matching for line breaks differs across regex engines, and the same modifier letters can mean different things. Ruby, JavaScript, and Perl use different patterns for matching any character.

Putting static content on Cloudfront

Static assets on CloudFront can speed up page loads, but cache invalidation, gzip handling, SSL, fonts, and mixed-content rules need careful handling.

Split an array into columns

Distributing array items into visual columns is awkward with in_groups and in_groups_of; in_columns returns wrapped column arrays in pure Ruby and Rails.

Setting up Ubuntu Server as Virtual Machine in VMware

Ubuntu Server in VMware needs manual VM setup, VMware Tools installation, and display and keyboard configuration for a usable desktop console.

Bash script to run specs and features

Run rspec and Cucumber from any project directory with optional spinner support; features are skipped when specs fail.

Nautilus File Manager slows down the system after new installation of ubuntu

Ubuntu One can start after installation and try to sync the entire home directory, making Nautilus File Manager extremely slow.

Change the hostname on Mac OS X

Set a Mac’s network name from Terminal when the default hostname is wrong or needs to match a local domain.

Using QEMU to quickly test an ISO or bootable USB drive

Bootable media can be tested quickly in QEMU instead of setting up VirtualBox, using an ISO or a USB drive directly.

Vector Magic: Precision Bitmap To Vector Conversion Online

Convert raster images to scalable vector files for cleaner artwork, smaller files, and sharp resizing without manual tracing.

Playing audio in a browser

Browser audio playback is fragmented across Flash and HTML5, with codec, seeking, loading, and styling limitations that often require a hybrid library.

Print-Friendly Images and Logos with CSS

The trick is this: send a low-resolution version of your image to the screen, and a high-resolution version to the printer.

Git Cheatsheet

Git state management is easier when you know which commands change the working tree, index, stash, or upstream references.

javan/whenever - GitHub

Whenever is a Ruby gem that provides a clear syntax for writing and deploying cron jobs.

Validations on associated objects

Conditional validation across associated records can fail during new parent creation because the child object is not yet linked. Moving the check to the parent and using sticky errors keeps the child invalid.

Speed up Capistrano deployments using a remote cached copy of repository

Capistrano deployments can be much faster by reusing a cached repository copy on the server instead of cloning from the git host each time.

Apprise - The attractive alert alternative for jQuery

A lightweight jQuery alert and dialog replacement with full control over styling, content, position, and behavior, without a full UI framework.