February 2012
2 posts
8 tags
This week in open source
bourbon
As a programmer I love the change that made it into version 1.3.6 (10f978d) of bourbon: Phil LaPier (plapier) added to work done by Frank (frankzilla) to add a monospaced font family, $monospace—with support for Bitstream Vera Sans Mono, my favorite monospace typeface (3467fe3 and c86e5687). Nice.
paperclip
Friday saw a new release of paperclip (1cb40e3), in accordance with the...
4 tags
Decoupling Data from Presentation
I’m really happy to see a resurgence in an understanding that writing
integration tests that use classes and DOM structure to perform assertions
within these tests is typically a bad idea. The DOM structure constantly
changes but the data displayed (the stuff we want to assert is present on a
page) typically doesn’t.
Why write tests against some markup that a designer may change,...
January 2012
12 posts
6 tags
This week in open source
bourbon
Over the past week bourbon went up to version 1.3.5. A whole bunch of sweet new features are in it now:
Frank (frankzilla) added a modular-scale mixin, of which the golden-ratio mixin is but one implementation (126a83b and 96659a2). He also added a parameterized fallback color to linear-gradient (60e2c63).
Phil LaPier (plapier) worked with Gabe Berke-Williams (gabebw) on a bourbon...
5 tags
Designer Tools
In addition to the basic development environment everyone at thoughtbot works with, there are a number of other apps most of the designers here use to keep our work flows efficient and our skills top notch. When I came to thoughtbot as an apprentice a little over three months ago, I was exposed to a variety of new apps that greatly improved my work-flow, so I thought I would share with you some of...
1 tag
A users guide to the Trajectory redesign
We released a redesign to the Trajectory UI today. I want to explain the thinking that went into the redesign, what the benefits to users are, and what’s in store for Trajectory as we move forward.
View of the main stories index.
First, let’s do a quick history lesson. A year and a half ago, we decided to build Trajectory to scratch our own itch. We wanted a lightweight agile...
6 tags
Inject that Rails Configuration Dependency!
Setting up configuration settings in a Rails app has been fairly
straightforward for a while now:
# config/environments/development.rb
Doit::Application.configure do
config.default_creator = "Person 1"
end
# config/environments/test.rb
Doit::Application.configure do
config.default_creator = "Test Person"
end
# config/environments/production.rb
Doit::Application.configure do
...
9 tags
Apprentice.io Three Week Retrospective
Over the past three weeks I’ve begun my apprenticeship at thoughtbot. The apprenticeship lasts until the end of March. I’m joined by designers Paul Webb and Edwin Morris, and fellow coder apprentice Alex Patriquin. Each of us is assigned to a mentor, who makes sure we absorb as much as possible of the thoughtbot way of doing things and achieve our specific goals. For me, the...
4 tags
Every Two Weeks
Our most popular gems—paperclip, capybara-webkit, factory_girl, and clearance—will see new releases every two weeks.
Trying to be reasonable
Release early, release often. In the past we’ve often released new versions of gems in a “when we feel like it” fashion: either we needed the gem to exist for a personal project, or we’re proud of some change we just made, or...
2 tags
Factory Girl 2.5 Gets Custom Constructors
Today marks a big day in the life of Factory Girl; you can now override the
constructor for factories! This is great news for people who’ve been upset
that they can’t use Factory Girl with objects who have constructors with
required arguments, as Factory Girl would previously just call new without
passing any arguments.
Here’s the syntax:
# app/models/report_generator.rb
class...
7 tags
This week in open source
shoulda-context
Hey! shoulda-context has a maintainer! His name is Travis Jeffery (travisjeffery) and he’s got commit rights and everything! Thank you, Travis.
Yeah!
cocaine
One feature was added to cocaine over the past week: Daniel Mircea (viseztrance) made it such that you can now pass blank argument values (a2d01c4). For example, this now works:
command_line =...
12 tags
This week in open source
Deprecations
We have officially stopped maintaining the following open source products: limerick_rake, trout, shoulda-context, and jester. Do you want to take over any of them? Let us know!
kumade
The kumade Heroku deployer now has a rake task hook for running code before the deployment (8bd2824). This was done by Joshua Clayton (joshuaclayton) in the new version: 0.8.2...
4 tags
Factory Girl 2.4 Goes Meta
Factory Girl has been getting
some hardcore internal refactorings over the past few months.
Traits
are a great example of something that’s started very bare-bones with a few
caveats and been transformed to one of my favorite features of the Factory
Girl syntax. It required a pretty decent chunk of refactoring and there were
bugs for quite a while due to the way attributes in general were...
4 tags
Vim Macros and You
Ever get the urge to update a ton of files? I know I do. For example, I
recently changed multiple hundred coffeescript files from the syntax of
MyGreatClass = Backbone.Model.extend(
defaults:
awesome: true
)
to
class @MyGreatClass extends Backbone.Model
defaults:
awesome: true
How long did it take me? A couple of minutes. Here’s how.
Ack (or Grep)
I like ack. To find...
3 tags
Use Bundler's binstubs!
If you’re not using bundler’s binstubs with RVM integration yet, you should give it a try! This means you don’t have to type “bundle exec” ever again.
Setup:
One time, run chmod +x $rvm_path/hooks/after_cd_bundler
Once for each project, run bundle install -—binstubs
With rvm integration enabled, the “bin” directory is added to your path each time you cd into a project directory with binstubs....
December 2011
10 posts
6 tags
Evaluating alternative Decorator implementations...
Recently, decorators have become a big part of my Ruby on Rails life.
We used them heavily in a recent client project, Harold Giménez wrote a great post about them, Avdi Grimm is writing about them in Objects on Rails, and Jeff Casimir has a great presentation about them.
Until recently, I still had some questions, however, such as:
Should I roll my own decorators?
If I roll my own, what...
4 tags
A quick screencast that shows how I use CSS snippets to speed up my workflow.
Links Mentioned in video:
Textmate Zen CSS
Textmate SCSS
Vim CSS Snippets
My Vim CSS Snippets
7 tags
This week in open source
paperclip
Much of the work over the past week was done in paperclip, so now you can upload files to your Rails apps with more flare and style!
It now supports an option for keeping old files, so you can pass :keep_old_files to has_attached_file and, when you destroy an attachment (@user.avatar.destroy) it won’t actually delete the underlying files (345ec74). Many people find this useful...
5 tags
Internship or Apprenticeship?
What’s the difference between an internship and an apprenticeship?
Internship
An intern is someone who:
usually wants to explore many options for their next job, or career in general
may be unpaid
is probably in school
A company who hires interns:
often has special project work that is a good fit for part-time employees
knows it’s very likely the intern will work or study...
2 tags
This week in open source
Few commits over the past week. We’ve been hard at work on refactorings and larger features (plus client work), so keep your eyes peeled for the amazing commits we pull from you (yes, you!) in coming weeks.
suspenders
Commits on suspenders this week bring us instructions on how to use the app with Heroku (257ea39 and 5a4c257), revised documentation “that is awesome, not...
1 tag
Here's an Idea
Today we’ve launched several major changes to the Discussions feature of Trajectory. These changes lay the groundwork for many more improvements we’d like to make to Trajectory in the future to make your projects more successful.
Discussions are one of the things that make Trajectory different than other story planning tools out there. Create a discussion instead of a vague story...
3 tags
The Durable Document Store You Didn't Know You...
As it turns out, PostgreSQL has a number of ways of storing loosely structured data — documents — in a column on a table.
hstore is a data type available as a contrib package that allows you to store key/value structures just like a dictionary or hash.
You can store data in JSON format on a text field, and then use PLV8 to JSON.parse() it right in the database.
There is a native xml data type,...
7 tags
I learned to alias shell commands with Hooked on...
Do your co-workers snicker at your sentence-length shell aliases? I’m here to tell you it’s okay because my aliases border on the Dostoyevskian, too.
Some commands you do a thousand times a day. They deserve super-short aliases:
alias be="bundle exec"
alias s="bundle exec rspec"
alias cuc="bundle exec cucumber"
Like h() or t() in Rails, the more often you invoke a command, the...
3 tags
This week in open source
Since last week was Thanksgiving here in the States, here’s a double-whammy: everything that happened last week and everything that’s happened this week, in one blog post!
suspenders
The big deal with suspenders, our app app, is that version 0.3.2 is officially out! Since 0.3.1 on October 28th we’ve added an email validator, raised email delivery errors in the development...
6 tags
Tidy views and beyond with Decorators
The problem
Here’s a view serving monkeys#show. What’s wrong with it?
<h1><%= @monkey.name -%>'s Monkey page</h1>
<% if @monkey.eating? %>
<div class="eating">
<h2><%= @monkey.name -%> is eating. Nom nom.</h2>
</div>
<% elsif @monkey.sleeping? %>
<div class="sleeping">
<h2><%= @monkey.name %>...
November 2011
15 posts
1 tag
The next Boston Vim Meetup
The first Boston Vim Meetup was awesome.
How awesome? This awesome:
Things went so well we’re going to do it again! The second meeting will be this Monday, December 5th. We’ll be meeting at the thoughtbot offices at 41 Winter St, 8th floor.
This time we’ll be having two talks: “Harmonizing your text editing and shell” by Darcy Parker, and a talk on...
2 tags
Thank you
Happy Thanksgiving! Here’s what thoughtbot is thankful for this year.
Our clients and customers
Thank you to our clients: Advertising for Humanity, America’s Test Kitchen, Authorigin, Blueleaf, Boston.com, Carbonrally, Pilot, Crowdtap, Downstruct, Eatabit, Groupize, Iora Health, SCVNGR, Strobe, Swaave, TABB Group, Taskcruncher, Vertical Performance Partners, ybuy, and the ones...
5 tags
Introducing Trajectory GitHub Integration
Today I’m pleased to announce the availability of one of our most requested Trajectory features, GitHub integration.
We’ve never really used the GitHub integration in any of the previous tracking/planning software we used because it’s so hard to use it consistently and well. When we set out to implement GitHub integration we set the bar high by insisting that it be...
4 tags
The vim learning curve is a myth
I’ve been speaking about and teaching people vim for several years now, and I’ve noticed a surprising pattern: people are literally afraid of learning the editor.
Over the years, the popular mythology around vim has become that it’s insanely difficult to learn; a task to be attempted by only those with the thickest of neck-beards. I’ve heard dozens of times from folks who...
10 tags
Controlling color with Sass color functions
Sass comes with functions that can easily be applied to colors in your CSS properties. These functions, when used correctly, can be incredibly powerful. They take some of the sting out of choosing and manipulating colors. When used with variables, they can speed up development drastically.
Let’s start off with a creating variable for the color that we’re going to...
2 tags
This Week in Open Source
The great bundler cleanup
We’ve been slowly transitioning all our gems to use Gemfiles and bundler’s gem tasks, but Gabe Berke-Williams (gabebw) is finally laying down the law. Welcome to the New Order: limerick_rake, paul_revere, cocaine, suspenders, pacecar, appraisal, shoulda-matchers, bourne, shoulda, high_voltage, flutie, paperclip, shoulda-context, and factory_girl_rails are now in line.
...
2 tags
How to find a time format for Ruby's strftime
Have you written a web application lately? If so, I bet you’ve been using good old strftime. I use this on every application I write, but the only format token I ever remember is “%m is for month.” Or is it minute?
You could pop open ri, man, cheat, or For a Good Strftime, but there’s a fun wrinkle: strftime behaves differently in Ruby 1.8 and 1.9, and the 1.8 version...
1 tag
Airbrake's new team
Airbrake’s grown nicely since it launched as Hoptoad a few years ago. As always, we’re extremely grateful for everyone who’s tried the product.
During that time, Airbrake has been one thing among many that we do (client work, open source work, workshops, other product work). We thought it deserved more attention in order to fulfill the broader vision for the product and better...
2 tags
This week in open source
kumade
Small bug fix in the kumade Heroku deployer from Gabe Berke-Williams (gabebw). Apps are now restarted after deployment (7c5a6c6). This led to version 0.8.1 of kumade (eed756a).
suspenders
Read my lips: no new features; that’s the tale for suspenders this week. Instead, the app generator got some internal improvements from Gabe Berke-Williams (gabebw) and Harold Giménez...
3 tags
Nearby in Open Source
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...
6 tags
Climbing back up the mountain
Today is the end of my fourth week as a Design Apprentice here at thoughtbot and it’s been pretty crazy so far. Before I got started I was excited to start filling in all the minor gaps in my knowledge. My first week was spent looking at documentation and demos for new tools and languages and running through tutorials. It was exciting stuff, and all seemed pretty straightforward. All I had...
4 tags
This week in open source
A somewhat short update this week, in large part because I’m writing this from a different timezone than normal. Next week I’ll be five hours slower, don’t you worry!
suspenders
New in suspenders, our Rails app generator: a pre-packaged email validator class (b91ea65), which probably mixes well with things like liaison. Also on the email front, delivery errors are a full error...
4 tags
The one-method silent killer in your Cucumber...
There’s a single method in your Cucumber suite, right now, that could silently allow regressions and ambiguity to slip in without you ever knowing. Guess which one! Actually, bonus points to you if you scroll down to the comments and make a guess before finishing this post.
Did you guess? If not, here are a few more hints.
It uses regular expressions.
It’s a large cascading...
5 tags
How-To: Quick Rails Benchmarking
This February 6th we are launching a new workshop: Advanced Rails. The workshop draws content from the Scaling Rails and Rails Antipatterns workshops, replacing them and creating best-of-breed content that will take your skill to the next level in creating well-crafted Rails applications that scale.
One of the topics we touch on is profiling and benchmarking your app. There are a number of tools...
4 tags
Design Patterns in the Wild: Null Object
I knocked out a pretty decent refactoring of some of the internals of Factory
Girl this past weekend. In one of my commits, I used the Null Object pattern
to simplify some conditional logic that was spread across a class.
What’s the Null Object Pattern?
The Null Object pattern describes the use of an object to define the concept
of “null” behavior. Typically, a null object...
October 2011
18 posts
3 tags
Appraisal: find out what your gems are worth
Since the introduction of bundler to the Ruby community, dealing with dependencies has gotten much easier. Almost every library now has a Gemfile that looks like this:
source "http://rubygems.org"
gemspec
This pulls runtime and development dependencies from your project’s gemspec and finds versions that can all agree with each other. Requiring any of your dependencies will always get the...
1 tag
This week in open source
kumade
The big changes to kumade this week: the rake task automatically works, and is properly tested too; the Less::More packager is gone; and the cucumber tests are more extensive and reusable. This is all in the 0.8.0 release of kumade.
All commits this week were from Gabe Berke-Williams (gabebw). He worked on the no-op asset packager, which is the useful for when you have no assets. It is...
5 tags
Copycopter now supports editing multiple locales
Does your Rails app have more than one locale? Is it a pain to edit your internationalized copy?
We’ve heard your requests to better support multiple locales, and are excited to roll out multiple locale support in Copycopter.
You can try out the new multiple locale support in your existing Copycopter-backed apps, read more about how it works, or check it out during a free trial.
...
4 tags
Test Rake Tasks Like a BOSS
Testing Rake tasks is one of the most painful things I do as a Ruby developer.
Even after extracting all the code out into a separate class (which helps a
lot), I still want to make sure I test that the right classes got called
correctly with the right arguments.
I wanted the subject to be the task, where I could call invoke, check its
prerequisites, etc.
describe "cron:hourly" do
...
2 tags
This week in open source
kumade
This week our Heroku deployer, kumade, saw some refactoring and some features. Gabe Berke-Williams (gabebw) marked slow cucumber tests as @slow (40c6803), fixed the check for the Heroku Cedar stack (4b7358e, 3180ad2, and 61d3ee8), and cleaned up the README (c0d12cb). He removed the intrusive Thor from the app (dc25839, e419061, and 0c8414d). He ensured the the no-op packager is never...
5 tags
Danger, Danger: High Voltage! Use Rails 3.1 for...
I’m a big fan of Jekyll, but boy do I love SCSS and CoffeeScript. I recently set out to create a static site using Rails 3.1, to take advantage of the lovely Sprockets integration. There are alternatives (like Middleman, and Octopress) but I wanted to use Rails itself instead.
Our homebrewed high_voltage gem allows for static pages, so I wanted to use that to hook up my little static site...
3 tags
Design for Developers
I’ll be teaching the next session of our Design for Developers workshop on December 7th & 8th at our Boston offices.
The workshop is aimed at developers (as well as non-developers) who know HTML and CSS, but feel like they don’t have the graphic design skills to make something that looks good enough to show customers and clients. I want to ease the pain of developers who feel...
4 tags
Backbone.js on Rails live audio Q&A chat
Last Friday, October 14th, we hosted a two hour live Q&A chat for purchasers of our Backbone.js on Rails eBook with co-author Jason Morrison. We invited people who have downloaded the book to submit questions ahead of time, and then join us in chat for a discussion.
We’re pleased to offer the recording and notes as a free resources. You can download the Backbone.js on Rails live...
3 tags
This week in open source
bourbon
Another week of Sass mixins known as bourbon. Phil LaPier (plapier) gave the background-image mixin support for linear and radial gradients (f54da8f, 5e4cea2, b5d42a7, 36b678e, and a63dade). Sean Lynch fixed the webkit gradients on older devices (e46ba1e).
Matthew Burket (Mab879) fixed the README to point out that Rails 3.0.x is up to 3.0.10 now (098ef82). Matt Jankowski (mjankowski)...
5 tags
Factory Girl 2.2, your new best friend!
Aside from a handful of internal code clean up, Factory Girl
2.2 brings a handful of
awesomeness to the table. Factory Girl 2.1 was released a mere month and a
half
ago
but loads of improvements have been added since then. Some key features:
Attributes from traits can be modified
When we introduced traits, there were a couple of caveats: you couldn’t
override traits’ attributes from...
6 tags
capybara-webkit doesn't like #fork
Recently, when helping to convert a feature suite to use capybara-webkit, we ran into a problem where, about halfway through, the tests would start erroring out with Errno::EPIPE.
Errno::EPIPE is a “Broken Pipe” error. A pipe in Unix is a way for data to flow from one process to another, and a broken pipe means that one end of the pipe isn’t connected anymore. In this case, the...