Today I switched from RVM to rbenv. This ThoughtBot post was a great starting point.
I ran into a couple hitches. Here’s how I got through it. Do this stuff before you start the ThoughtBot stuff.
First, brew doctor. I ran it a bunch of times and followed the steps until it was clean.
The hardest step was XCode. I was running 4.2.1 and brew wanted 4.6.3. I downloaded the new 4.6 version through the app store, but brew was still using my old standalone 4.
Here’s what Heroku says about dyno memory usage:
Dynos are available in 1X or 2X sizes and are allocated 512MB or 1024MB respectively.
Dynos whose processes exceed their memory quota are identified by an R14 error in the logs. This doesn’t terminate the process, but it does warn of deteriorating application conditions: memory used above quota will swap out to disk, which substantially degrades dyno performance.
If the memory size keeps growing until it reaches three times its quota, the dyno manager will restart your dyno with an R15 error.
Make a file called epoch.rb in your project (I put mine in config/initializers). Use it to store constants that represent the times when big dev events happened. For example:
CART_RELEASE = Time.local(2013, 04, 22, 13, 45) We released our shopping cart at 1:45pm on 4/22. Fast forward to today: some of our stats are messed up, for deals that were live across the cart release. I need to fix the stats, but I only want to do it for the affected deals.
UPDATE: I made a gem! Just add gem "marco-polo" to your gemfile to see your app name and environment in your console prompt.
I hate when I have a bunch of consoles open and I don’t know which one is local, which is staging, and which is production. I could potentially do a lot of damage by using the wrong one. I find myself typing Rails.env over and over, to figure out which environment I’m in.
The Problem This technique came from my work on table_print, an irb tool for showing ruby objects in tables. I wanted to let people configure its output on a process-wide basis; eg, a default date format so sll their dates are shown consistently in the way they prefer. Additionally, I wanted a simple, easy-to-remember interface and a clean global namespace.
The Solution Here’s a basic syntax example for table_printing:
# prints all the authors, along with their book titles and photo captions > tp Author.
Pulled this out of a talk by Avdi. This technique is described at 16:00 in the video.
It’s nice for the user of a library to be able to catch any error coming out of the library, but at the same time, it’s nice for a library to pass through basic error types like HTTPError. To solve the problem, you can “tag” the HTTPError with your own error class, essentially raising both types of error:
I attended the Chicago Ruby Hack Night meetup last tuesday. The theme was IronMQ, a message queue web service. You can post/get/delete messages through a set of super simple HTTP endpoints, and they handle the tricky (or at least boring) stuff like storage, retries, etc.
Honestly, I almost didn’t go. I know that exposure to new technologies is good for me, but usually I have a hard time justifying messing around with something that doesn’t relate to a bigger project (be it professional or personal).