What is Toluu?
Toluu is a free service for sharing the feeds you read and discovering new ones.
Get Invite

GIANT ROBOTS SMASHING INTO OTHER GIANT ROBOTS - Home


What good is a flexible paperclip?December 30 2008

Originally found at http://flickr.com/photos/toofarnorth/9984261

Since it’s the Holidays, I’ve been spending a bit more time than normal on Paperclip. And since that time has been particularly fruitful and there’s been a release or two, I figured I should probably tell someone about it before I friggin’ explode. It’s all about making Paperclip more flexible, more adaptable, and more friendly to use. Can you believe there’s more to file uploads than avatars?

Newer, more sensible defaults.

Overall, this is actually a bit small on the change meter, but it may affect some of you, so it’s up front. The :path and :url defaults have changed. By default now, files will be saved to :rails_root/public/system/:attachments/:id/:style/:basename/:extension. It’s the “system” part of that that’s important, because now it means that if you’re deploying with Capistrano, you don’t have to do anything and your attachments will survive deployments. This was not previously the case, regrettably, but it is now!

Callbacks and such.

Thanks to the callback methods pioneered by ActiveRecord itself with the fantastic before_save and family, Paperclip now defines a before_post_process and after_post_

Access Hoptoad on Your iPhoneDecember 29 2008

As our holiday present to you, we’ve just deployed a new iPhone interface to Hoptoad.

Now, when you visit Hoptoad on your iPhone (for example, following a link to an error in an email you receive from Hoptoad) you’ll be presented with a nice view formatted specifically for iPhone.

While this interface is specifically tested on iPhone, it also works on Android. So, if you go to Hoptoad on an Android phone, you’ll be given this new interface as well.

Enjoy!

irb & script/console tipsDecember 23 2008

Let’s get interactive. You can learn a lot about your application from irb & by extension, script/console.

Wirble: colors

Color matters. You’re picky about your text editor syntax highlighting and maybe you use the excellent redgreen gem for colors in your test backtraces. Gotta have it in irb, too.

First, install Wirble:

sudo gem install wirble

Then, in your ~/.irbrc:

1 2 3 4 require 'rubygems' require 'wirble' Wirble.init Wirble.colorize

Wirble: history

Wirble has an added bonus: history.

1 2 3 irb(main):001:0> history = "History?" => "History?" irb(main):002:0> exit

Without Wirble, if you drop back into irb, you can’t arrow up to your previous commands. With Wirble, you can.

Wirble: auto-completion

As if that’s not enough, Wirble gives you auto-completion, too. In irb:

1 2 >> un_momento = "Spanish for like, 'hold the phone!'" =>
I accidentally the whole SMTP exceptionDecember 22 2008

You have a slick, exclusive, invite-only Web app for sharing Tor URLs, with an Android client and specialty hardware. You use validates_email_format_of in the Invitation model, but still something slips through and your Hoptoad errors pile up, showing your user the beautifully-designed 500 page instead of an error explanation.

There are two types of exceptions that ActionMailer will raise when you attempt to deliver an email: user input problems and server problems.

User input problems are those such as incorrect or invalid email addresses; the exceptions raised are Net::SMTPFatalError and Net::SMTPSyntaxError. These are issues that the user can fix and as such the error message should indicate that everything's fine, nothing is ruined.

Server problems could be anything from a non-existent server to an authentication issue; the exceptions raised are: TimeoutError, IOError, Net::SMTPUnknownError, Net::SMTPServerBusy, and Net::SMTPAuthenticationError. These issues are outside the power of the user and should indicate that we screwed up.

So in config/initializers/errors.rb:

1 2 3 4 5 6 7 8 9 10 11 12 SMTP_SERVER_ERRORS = [TimeoutError, IOError, Net::SMTPUnknownError,
thoughtbot is filled with vim and vigorDecember 19 2008

Slowly over the past year thoughtbot has turned from an all-TextMate (and one Emacs) group into a mostly-vim group. Here are some tips, tricks, and scripts we've mastered along the way:

From Mike Burns

I've been a vim user for six years, and brought the vim fever to thoughtbot. I tend to rely more on the built-in commands than on scripts and plugins. My favorite commands start with f and t (think first and 'till - see :help f or :help t):

Finding characters with f and t rocks. For example, if you're at the beginning of:

{:foo => 1, :bar => 3, :baz => 8, :barney => -1}

And you want to put a newline after the comma, you can do:

f,a<ENTER>

To jump to the next comma and repeat the prior action you can do:

;.

This is because ; repeats the prior f or t, and . repeats the prior modification. If you have to do this a lot in a row, you could make a macro from it:

qa0f,a<ENTER><ESC>q

This sets the macro named 'a' as: go to the beginning of the line, find the first comma, and append a newline after it. You can then repeat this marco with @a and repeat that macro (the one you just did) with @@.

You can also use t and f as a motion for, say, c and d. Like if you're at the beginning of:

<img src="/images/michaelphelpssupersaiyan.gif" />

And you need to change the image source to "/images/giant_french_spider.jpg". It goes like this:

2f/ ct"giant_french_spider