Nearby In Open Source

Mike Burns

We have a weekly blog post on the state of our gems, which we affectionately call “This Week in Open Source”. My favorite part about it (the reason I started it!) is that we get to thank the contributors publicly and officially.

Today I’d like to expand the thanks just a tiny bit: I’d like to thank people who are building on top of our open source work, extending it beyond our dreams. While I’m at it, I’d also like to highlight some of the non-thoughtbot open source work we build. I call this … Nearby in Open Source.

capybara-screenshot

Matthew O'Riordan (mattheworiordan) built on top of capybara-webkit to give the world capybara-screenshot. It’s pretty slick: any time you have a capybara test failure, it saves a screenshot of the headless browser.

Installation is simple; toss this in your app’s Gemfile:

group :test do
  gem 'capybara-screenshot'
end

… and that’s it. It saves screenshots away in tmp/capybara. The simplicity is beautiful.

So give it a try and maybe send him a pull request or a follow.

delayed_paperclip

Jesse Storimer (jstorimer), from all the way up in Ottawa, figured out how to process Paperclip attachments in the background using DelayedJob or Resque. He packaged it all together as delayed_paperclip, and it’s the way to go for delaying Paperclip processing. It even works with S3.

It’s a little trickier than capybara-screenshot to get running, due to the nature of the beast. But it’s also well-documented in the README.

In your Gemfile add delayed_paperclip:

gem 'paperclip'
gem 'delayed_paperclip'
gem 'resque'

You must also have Resque (or DJ) configured and running properly.

To have things function more smoothly you should add an attachment_processing boolean to your database table. Like this:

./script/rails g migration add_avatar_processing_to_users avatar_processing:boolean

In your model you need to explicitly state that the attachment is to be processed in the background:

class User < ActiveRecord::Base
  has_attached_file :avatar, :styles => { :medium => "300x300>", :thumb => "100x100>" }

  process_in_background :avatar
end

And there you go; background processing for your Paperclip uploads. Thanks, Jesse!

mongoid-paperclip

Speaking of Paperclip, Michael van Rooijen (meskyanichi) of The Netherlands figured out how to use MongoDB to store file upload data. He’s named this solution mongoid-paperclip.

The set up is straight-forward. In your Gemfile:

gem 'mongoid-paperclip', :require => 'mongoid_paperclip'

And in your model, where normally you would use has_attached_file, instead use has_mongoid_attached_file:

class User
  include Mongoid::Document
  include Mongoid::Paperclip

  has_mongoid_attached_file :avatar
end

We hack code too

Speaking of having things to share, we coders at thoughtbot are also coders outside of thoughtbot. Here’s a quicker summary of some sweet hacks we’ve rocked:

Nick Quaranto

Nick is qrush on GitHub. Follow him if you like these things:

gitready
A bunch of tips for using git.
rubygems.org
Some central storage Web site for gems. [You might have heard of it](https://rubygems.org/).
danger_danger
A sample Web site, mixing Rails with high_voltage. He wrote a blog post about this.
counter
A tool to help score a game of Carcassonne.

Jason Morrison

Jason is jasonm on GitHub. Maybe these tickle your fancy:

Sample apps:

backbone_sync-rails
A spike of a WebSockets-based, instant feedback, Rails and Backbone app.
chat_app
A chat app showing how to mix Backbone, Cucumber, and Jasmine.

Presentations:

backbone-js-on-rails-talk
A talk on mixing Backbone and Rails, delivered at NH.rb and Boston.rb last month.
backbone-front-end-presentation
A talk on using Backbone, delivered at the [Boston Frontend Developers](http://www.meetup.com/Boston-Frontend-Developers/events/37125612/) meetup.

Ben Orenstein

Ben is the amusingly-named r00k on GitHub. Two things in the past month, both related to his mouth:

talk_notes
Notes from his talk on Vim for Rails, which he gave both at RailsConf 2010 and at the first Boston Vim meetup.
dtx_site
The Web site for the quartet in which he sings.

Chad Pytel

Chad, or cpytel as we like to call him, had one talk-related repo last month:

fowa-backbone
A talk on Backbone delivered at the Future of Web Apps in London.

Gabe Berke-Williams

Gabe, with his long name and all, can be followed as gabebw on GitHub. Here’s some chat-related stuff he’s done in the past month:

chat_stew
An Adium log parser.
pidgin2adium
A tool for importing pidgin logs into Adium.
memetron
Natural language processing simulator for things that Reddit finds funny.
fuckyeahfuckyeahproxy
A proxy server to make Campfire understand images that don’t end in `.jpg`, specifically targetting fuckyeah.heroku.com.

Harold Giménez

Harold, hgimenez on GitHub:

presentations
A talk on using Redis, amusingly titled “Redis: Nimble Data Bacon”, presented at PG West 2011.
truncate_html
A classic Rails gem for truncating a piece of HTML. (I also wrote this a bunch of years back!)
stack
A sample app, serving as a gentle introduction to test-driven development.

Mike Burns

I can be found on GitHub as mike-burns. Some things I’m excited about:

liaison
An abstraction of the Rails presenter pattern, in a non-intrusive, object-oriented manner.
method_missing
Those methods that should have existed on Ruby’s `Method` object.

… And More

Those are the gems that metaphorically came across my metaphorical desk over the past literal month. Do you have any to share? Any you’ve written?