Double Shot #642

I'm about ready for a weekend. Fortunately, I can see one coming.

Double Shot #641

Sleep seems overrated until you have to skip it for a while.
  • gMap - jQuery plugin for Google Maps. Looks way easier than the last way I've done it.
  • webtranslateit - Gem to integrate a Rails app with Web Translate It, a web service to help provide localization.
  • Why use HAML (and SASS)? I already know HTML. - Another argument in favor of switching to HAML/SASS. This is rapidly becoming the vi vs. emacs of templating languages.
  • toto - Blog engine built atop rack and aimed at heroku deployment.
  • Ubiquitous Analytics and Tableau Public - This looks nice; the Tableau data visualization app is one of the things I remember from Windows days, and now they're bringing it to the web.
  • DTerm - Popup command line for OS X.

Double Shot #639

Early morning coding is the most peaceful time of day.

Easy rcov with Test::Unit and Rails 2

Yesterday, I needed test coverage numbers for an application using Rails 2.3 and plain old Test::Unit (still my test framework of choice). This proved to be a good deal more difficult than I expected: there are so many forks of the original rcov code, and so much disparate advice on how to get it hooked up, that I spent a great deal of unprofitable time reading before I got the right combination. Hopefully this short list will save you from doing the same:
  1. Install the relevance-rcov gem. This is the stable and maintained fork.
  2. Install the commondream rcov_plugin. This has the best set of working rake tasks I've found.
  3. Add coverage/* and test/coverage/* to your .gitignore.
  4. Run rake test:coverage to generate coverage results.
  5. Open /coverage/index.html in your project to view the results.

Double Shot #638

It's February, and I've got a team of devs coming available for new work. Happy to chat about any prospective projects you might want done.

Double Shot #636

And no, running HTML 5 does not make a closed proprietary device magically open.

Double Shot #635

It was a busy day, but not on the web-surfing front.
  • rest-client - I've played with a bunch of applications designed to test RESTful web services; this is the one I'm currently using. It's a Java app, but it's got a decent OS X build.

Double Shot #634

Yesterday's catches in the link sea...

Double Shot #633

It was a busy weekend - apparently for other people as well as for me.

Double Shot #632

12 is really too many billable hours for one day.

Double Shot #630

Notes on Using Jammit with Rails

I spent some time this weekend wiring up a new Rails application to use Jammit for asset caching. So far I'm quite happy with the results; it offers a sophisticated set of asset caching strategies (indeed, we're not even making use of them all yet) and does its compression on the client side during the deployment process. For those who aren't complete experts in all things sysadmin, a few notes on making this work: 1) If you're using the rails_xss plugin (or Rails 3), you'll need to make sure it doesn't try to escape the HTML generated by the Jammit helpers. You do this by wrapping all calls to those helpers in the raw helper:

<%= raw include_stylesheets(:common, :media => 'all') %>
<%= raw include_javascripts(:common) %>
2) For deployment, I'm using this chunk of code in my Capistrano recipe (hat-tip to kpumuk whose gist I started from):

namespace :deploy do
  desc 'Bundle and minify the JS and CSS files'
  task :precache_assets, :roles => :app do
    root_path = File.expand_path(File.dirname(__FILE__) + '/..')
    assets_path = "#{root_path}/public/assets"
    gem_path = ENV['GEM_PATH']
    run_locally "#{gem_path}/bin/jammit"
    top.upload assets_path, "#{current_release}/public", :via => :scp, :recursive => true
  end
end
after 'deploy:symlink', 'deploy:precache_assets'
This will build the assets locally and then upload them. You'll want to add public/assets to your .gitignore file. 3) You should have mod_expires loaded in Apache to handle far-future expiration dates for asset access. If this is missing, you'll get an error when you try to load a configuration file that includes the ExpiresDefault directive. On Debian, this is as simple as moving expires.load from /etc/apache2/mods-available to /etc/apache2/mods-enabled (which is what a2enmod does). If you're using some other flavor of OS, try this article for instructions. OS X includes mod_expires by default. 4) The Passenger documentation says flat out that MultiViews is incompatible with Passenger. So far, I haven't found any problem enabling MultiViews just on the assets directory, though, probably because it doesn't go through Passenger. 5) Here's a vhosts entry that sets things up for a Jammit-enabled application:

<VirtualHost *:80>
   ServerName myapp.com
   RailsEnv production
   DocumentRoot /u/apps/myapp/public
   <Directory "/u/apps/myapp/public">
      Options FollowSymLinks
      AllowOverride None
      Order allow,deny
      Allow from all
   </Directory>
   <Directory /u/apps/myapp/public/assets>
      Options MultiViews
      ExpiresDefault "access plus 1 year"
   </Directory>
</VirtualHost>

Double Shot #628

The inital round of the Developer Wellwishes campaign is drawing to an end on Thursday, when we'll be combining donations with a few other campaigns to make a contribution to charity:water. If you've done your share for earthquake relief and still want to help more people out, do drop by.
  • Distributed Ruby with the MagLev VM - A nice look at what's going on with this alternate Ruby, which to my mind is more significant than Rubinius or MacRuby. Being able to store distributed objects with no ORM is likely to be a killer feature.
  • Deadweight and Helium - CSS coverage tools that can report which selectors are unused in your application.
  • popthis - Turn a folder of email files into a POP3 server for testing purposes.
  • git-googles - Git utilities for branch management and code review.
  • The least you should know about S3 with Rails - This stuff is all out there, but here's a one page overview.
  • Yaml Cookbook - Turns out Ruby's YAML support is a good deal more flexible than I had realized.
  • Ruby Fibonacci Shootout - MacRuby is turning out some impressive performance numbers. Too bad it can't run anything I care about yet.
  • has_price - DSL for organizing things like taxes, discounts, and base prices. Wish I'd had this a year ago.
  • cacheable - Gem that adds cacheify, which is similar to memoize but uses memcached.

Double Shot #627

Some odds and ends before I fling myself at a pile of tax paperwork.

Double Shot #625

Next couple of weeks are looking super busy. Better than the alternative by far.
  • I Have No Talent - Words well worth reading from John Nunemaker. There are ample ways to succeed in this business without being some sort of uber-coding genius. Trust me, I know.
  • I Am Not a Master but a Solutionist - And Rob Bazinet chimes in to promote getting the job done.
  • Sandstone - One more approach to CMS in Rails. Looks like there are several active branches with no one merging them though.
  • Vote for Barbie's Next Career - "Computer engineer" is in the running.
  • TotalFinder - Using SIMBL to make Finder better in Snow Leopard.
  • TipTip JjQuery Plugin - A simple custom tooltip plugin.
  • Bombax - Objective-C and Cocoa web development framework. No thanks.
  • workflow - Another state machine alternative for Ruby.

subscribe via RSS