Let's make Twirp and Protobufs easier with Ruby
We love Protobufs and Twirp, but what if we could make them even easier for Rubyists?
Collapsing old Rails Migrations
I don’t like deleting old migrations in my Rails apps, but if I did, here’s how I’d do it,
Team Tools Roundup
Our distributed team uses some really interesting tools to do the work we do. Check out our tool roundup to find some new tools to try yourself.
Testing an Uploaded File in Rspec
Sometime you need to test how your code handles an uploaded file, but you don’t want to upload it in your test. Luckily, there’s an easy way to handle this.
Getting Started with Action Cable
With the inclusion of Action Cable in Rails 5, we can easily add WebSockets to our Rails applications. This post walks through how to set up Action Cable as a response to an action on an Active Record model.
Avoid parsing Rails controller params by using Metal
While looking at a controller today, I came to the conclusion it’s better to use ActionController:API
instead of ActionController::Metal
. Here’s why.
My Ruby Epiphany
I’ve been using and teaching Ruby for many years now, but I recently had an epiphany about private methods.
Solutions to Potential Upgrade Problems in Rails 5
The Rails 5 upgrade has a few changes that may cause confusion. We look at how to get around the disabling of autoloading and look at the new deprecation warnings.
Interview: Talking Middleman V4 and Front-end Dev with Thomas Reynolds
Middleman was built by Thomas Reynolds over eight years ago as a way to build static sites with easy-to-use framework. I talk with Mr. Reynolds about a few new features for Version 4 of the tool.
Keep Your Certificates Current Using Your Test Suite
How can our test suite tell us when a certificate expires? We’ll show you.
Bi-Directional and Self-Referential Associations in Rails
I’ve been working on an application that works to match users together based on a complex set of criteria (read: big slow database query and in-memory processing). The core usage of the application revolves around these user matches, so I want to make sure that either the algorithm will run very fast or can be cached so that it’s not run every time a user visits their matches page.
The most important requirement for our matches is reciprocation. To solve this problem and meet all of the requirements, we can create a bi-directional, self-referential, self-syncing, many-to-many association between users using a has_many :through
association with a join model to keep track of a user’s matches.
Quick Setup for Your Rails Apps
We need to make getting up and running with our Rails apps easier. Here’s my attempt.
Fixing Intermittent Failing Tests
Some tricks to help you fix tests that sometimes fail.
Better Ruby Rounding
Need to round to the nearest 30 minutes or up to the next 250 or some other fun rounding case? Ruby’s build-in round
, floor
, and ceil
won’t help you, but the Rounding gem will.
Bootstrap Your App
Insert your app’s bootstrapping into CI to ensure that setting up a new developer is one script invocation.
Streaming Data From Postgresland to Rubyland
I recently gave a talk covering find\_each
, pluck
, and the PostgreSQL Cursor gem for the West Michigan Ruby Users Group.
Optimizing Rails for Memory Usage Part 4: Lazy JSON Generation and Final Thoughts
Code to copy-paste so you can lazily serialize JSON and maybe even stream it to the client, and an argument for why we shouldn’t have to do any of this.
Optimizing Rails for Memory Usage Part 3: Pluck and Database Laziness
Some ways to reduce memory usage as you gather records out of your database into Rubyland.
Optimizing Rails for Memory Usage Part 1: Before You Optimize
Part one of a four-part series which will show you how to optimize a memory-heavy Rails API action.
Optimizing Rails for Memory Usage Part 2: Tuning the GC
Changing Ruby’s garbage collection parameters is the least invasive way to optimize your app’s memory usage.
Quickly Test Slow Uploads
How do you test a slow file upload? Force it to be slow.
Let's Simplify Ruby
I want to make Ruby better by making it smaller. Who wants to help?
How we write a Gemfile
Tips on how we like to organize Gemfiles and keep it clean.
Why Isn't Ruby Rescuing My Exception?
By default, Ruby only rescues subclasses of StandardError to allow the really bad stuff to halt your program.
Segmentation faults on Travis CI caused by libxml-ruby
If ruby is segmentation faulting on Travis CI, try updating libxml
Public Methods != Public API
I love designing and building APIs. Usually those APIs are in the form of REST web services. A lot of care goes into the interface of a web service because it’s how your application is presented to the outside world. But what about the interfaces of your internal code?
Mocking HTML5 API's Using PhantomJS Extensions
Recently one of our projects called for using the browser’s Geolocation API. We were excited about this project. However, we had an immediate concern about how to test a feature that interacts with one of the browser’s built in APIs.
Ruby 2 SSL Verification Failed?
Many users are having OpenSSL validation issues with Ruby 2.0 across various platforms. Turns out there are multiple issues at hand, each requiring different fixes.
Tests Still Slow? Might be bcrypt!
How Google’s perftools led me to add a single line of code that cut test suite run times in half.
Fun with Unicode Math in Ruby √
We had way too much fun with Ruby and Unicode, and the result is that you can now join in the fun with our unicode_math gem.
5 Awesome Things About RubyMotion
Last week HipByte released RubyMotion and although I was originally skeptical, I’ve grown to really like it.
Walken on Rails
Our new screencast series features narration by Christopher Walken.
Give pry a Try
One of the things holding us back from developing on Ruby 1.9.3 has been ruby-debug. So after many people suggested we try it, we gave pry a shot. I don’t know why we didn’t before; it is quick, easy, and allows a wide range of Ruby versions.
Install Ruby 1.9.3 with libyaml on CentOS
Get Ruby 1.9.3-p0 installed with libyaml on CentOS to avoid warnings.
Thinking about Ruby's Symbols
Symbols in Ruby are confusing to new users.
What's "new" in Ruby
A quick introduction to Class.allocate, a class method you can use to allocate space for a new object and skip initialization of that object.
Test Multiple Rubies by Combining Bundler and RVM
I have read several opinions that are either pro-Bundler or pro-RVM, but despite the current debate they do not have to be mutually exclusive.
Rails 3.1 Hackfest this Saturday
There’s a Rails Hackfest this weekend and we are opening our doors to Rails devs who want to participate.
Speaking and Teaching at Lonestar Ruby Conf
I’m going to be speaking and teaching at Lonestar RubyConf this year. Look us up if you’re attending.
The Billy Baldwin of Conditional Assignment
For those of you who don’t know, Billy Baldwin is the lesser-known and generally-less-useful little brother of famed actor Alec Baldwin.
In the world of Ruby’s conditional assignment operators, ||=
is Alec Baldwin; charming and versatile. But not many people know about ||=
’s little brother… the &&=
operator.
Bundler makes contributing to ruby gems easier
After using Bundler for the past few months, I love it. It turns managing project dependencies and deployment into a piece of cake. However after coming across a particular dependency declaration, something clicked in my head that made me like it even more.
Clever Custom Datatypes with MongoMapper
A whole world of rich objects is within your reach with MongoDB.
2010: The Open Source Tools that Made it Great
My list of open source tools that made a big impact on our work this year.