Debian/Ubuntu: See what "apt" would install without actually doing it
Check which packages and versions apt would install before making changes. --dry-run simulates upgrades without touching the system.
Installing RubyGems for Ruby 1.8.6
Ruby 1.8.6 is incompatible with newer RubyGems releases; RubyGems 1.4.2 remains the last version that installs successfully.
Dropbox + git = Designer <3
One of the thornier problems in our workflow is knowing when assets are delivered from the designer and keeping them in sync with our application as they change. We used to use e-mail, Skype or sticky notes. The trouble is that the designer's file naming and directory structure were never quite the same as the application's /public/images directory, so direct comparisons were impossible and we ended with a lot bookkeeping to make sure that we didn't lose any changes. Our solution is to clone the project's git repository into a folder inside ...
Open the on-screen keyboard on an iPhone or iPad with Javascript
iPhone and iPad browsers do not allow JavaScript to open the on-screen keyboard programmatically. The keyboard appears only after a user gesture in an editable field.
Installing RMagick on Ubuntu
RMagick gem installation can fail when ImageMagick development files or config tools are missing. Installing the matching libmagickcore-dev and libmagickwand-dev packages usually resolves it.
Opera: How to use outlining for better layout debugging
Opera’s User mode can toggle HTML element outlines quickly, making layout debugging easier when actual element dimensions and float behavior matter.
Opera 11: Show full address, including GET parameters
Opera 11 hides URL parameters and the protocol in the address field until focus, making copied links incomplete. A browsing preference restores the full web address display.
Default views in Rails 3.0 with custom resolvers
It is common in Rails 3.0 applications that you want to provide default views for a group of controllers. Let’s say you have a bunch of controllers inside the Admin namespace and you would like each action to fallback to a default template. So if you are rendering the index action for Admin::PostsController and “app/views/admin/posts/index.html.*” is not available, it should then render “app/views/admin/defaults/index.html”.
Since Rails 3.0, we have a new abstraction called resolvers that holds the logic to find a template.
How to send a test e-mail from shell
Manually verify outbound e-mail delivery from a machine with mail from the shell, either empty or with a typed message body.
Cast an ActiveRecord to a subclass or superclass
becomes casts an ActiveRecord record to a different STI class so Rails can treat it as another type, while both instances share the same attributes.
wycats/artifice
Artifice allows you to replace the Net::HTTP subsystem of Ruby with an equivalent that routes all requests to a Rack application.
You can use Sinatra, raw Rack, or even Rails as your application, allowing you to build up an equivalent to the remote service you are mocking out using familiar and convenient tools to route requests and build up responses.
mitmproxy
mitmproxy is an SSL-capable, intercepting HTTP proxy. It provides a console interface that allows traffic flows to be inspected and edited on the fly.
Safely chain scopes with hash conditions
Rails 2 and some Rails 3.x versions let chained scopes overwrite hash conditions on the same attribute, creating authorization leaks. chain_safely avoids that overwrite.
Weird margin at top of page
Unexplained whitespace at the top of a page can come from a BOM in one of the rendered views; saving the file without a BOM removes it.
Imperative vs Declarative Scenarios in User Stories
Imperative and declarative user-story scenarios suit different situations; declarative phrasing offers advantages in RSpec Story Runner and Cucumber testing.
Making IE 9 happy
Internet Explorer 9 compatibility can require a jQuery update to 1.5.1, and box shadows may render lighter and slightly offset.
Download all Google Web Fonts as a single tarball
Google’s Font Directory and API for web fonts could have a transformative effect on how we read the web. The only problem is, Google has made it very difficult to download all of the actual font files.
Web designers must be free to experiment with these new fonts, to sketch, comp and get to know these typefaces in browser and non-browser applications. This is why I’m providing this archive.
Where to put custom RSpec matchers
Custom RSpec matchers fit well in spec/support/matchers, one file per matcher, and can be loaded from spec_helper.rb or Cucumber features/support/env.rb.
Test that a hash contains a partial hash with RSpec
Use hash_including in RSpec to verify a hash or method call contains only the expected key-value pairs without matching the full structure.
Different CSS for IE using Sass
Different styling for Internet Explorer can be generated with Sass variables and conditional imports without relying on CSS hacks.
Do not deliver mails when there are no recipients set
ActionMailer can send empty messages when recipient arrays are generated dynamically; overriding deliver! prevents delivery when to, cc, and bcc are all blank.
Install LaTeX on Ubuntu 10.10
tetex is no longer supported on Ubuntu 10.10; texlive provides a supported LaTeX installation via apt-get.
Fixing "undefined local variable or method `version_requirements' for #<Rails::GemDependency:0x...> (NameError)"
Rails startup can fail with a NameError when version_requirements is missing on Rails::GemDependency; a small environment.rb patch restores compatibility with newer RubyGems.
Acceptance testing using Capybara's new RSpec DSL
Capybara now includes an RSpec acceptance-testing DSL, replacing much of Steak’s earlier role and making end-to-end testing in RSpec more seamless.