· Jerod Santo ·

+ Archives Contact Search

Development Posts

Ruby, JavaScript, Rails, CoffeeScript, and everything development-related

5 Answers For Coder Catchup Episode 100

22 Dec 2016

I was honored to answer 5 questions for Jaymie Jones' 100th episode of Coder Catchup

Safari does not trigger click events on anchors or buttons containing SVG elements

18 Aug 2015

This ruined my morning.

Trailing Conditionals Considered Harmful Unless Used Sparingly

08 Mar 2015

The reason why I'm bearish on trailing conditionals may best be expressed by a road sign I saw on a recent road trip down Interstate 80

Art-directed, data-driven image files to accompany your website

19 Jan 2015

Cody and I recently added a subtle feature to Oma/Sprout that we think is pretty neat.

List all Git commits that are on one branch, but aren't on the other

06 Sep 2014

This is super handy for Heroku-style deploys

A step by step guide to bulletproof 404s on Rails

20 Jun 2014

4 Steps and an obligatory fake step

Rails 4: let specific actions be embedded as iframes

04 Dec 2013

Rails 4 defaults the X-Frame-Options header to SAMEORIGIN for security reasons (and good ones at that). However, sometimes you want a specific action to be iframeable. Here's how.

Make ActiveAdmin and FriendlyId play nice

15 Nov 2013

Two handy tools that don't get along out of the box. Herein lies a workaround.

Your dev user should be really crazy

08 Nov 2013

Save yourself a lot of pain down the road by ensuring your system handles crazy input now.

Ruby Quick Tip: Easily Count Occurrences of Array Elements

24 Oct 2013

Have you ever needed to see how many times each element in an array occurs? Perhaps sort by those occurrences? Here's a quick and easy way to do it.

You don't have to annotate your AngularJS injections anymore

02 Aug 2013

So please stop

CoffeeScript Classes Play Nicely with AngularJS Factories

28 Jul 2013

In case you were wondering

Easy 'Share-Nothing' WordPress Blog Syndication on Rails

01 Mar 2013

There are many ways to skin the syndicate-a-wordpress-blog-content-in-your-rails-based-app cat. This is an easy one.

The Curious Case of ActiveRecord Matching Yesterday's Events Even Though I Told it Not To

19 Feb 2013

We uncovered a Strange Thing when working on Omahype's event listings.

Rate Limit POST Requests with Rack::Throttle

03 Feb 2013

Rack::Throttle is an awesome piece of middleware for rate limiting your app's clients. You can easily extend it to apply any rules you need, such as only limiting certain request types.

Fix Rails-API Oauth2 CSRF Errors On Rails 3.2.9+

01 Feb 2013

The fix to this obscure and nuanced bug after upgrading my Rails-API app to 3.2.11 is worth noting for others.

Configuring redis-store / redis-rails on Heroku

23 Jan 2013

redis-store's redis-rails is awesome, but it can be a pain in the buttox to get configured on Heroku. Herein lies buttox relief.

Dynamic Routes to Static Pages on Rails

07 Jan 2013

There's one thing that almost every web app and web site needs: static pages

A Handy Method to Share Data From Rails Controllers to Views Without Requiring Direct Instance Variable Access

18 Dec 2012

Rails' method of sharing data between controllers and views via instance variables bothers many developers, myself included. Here's a handy method you can use to avoid this in your apps.

Capybara and Poltergeist: Snap!

11 Dec 2012

Poltergeist is a great JavaScript driver for Capybara. Use this helper method to get quick page snapshots to debug your tests.

A Domainr CLI in Less Than 15 Lines of Ruby

27 Nov 2012

The arbitrary less-than-15-lines constraint is back, baby! This time, a Domainr CLI

An Algorithm to Reliably Identify Nested Substrings

12 Nov 2012

Regular expressions are great for matching many patterns, but they often fall down when dealing with recursive matching. In these cases, there is a simple algorithm that you can use which is more reliable than regular expressions.

A Common Gotcha When Using Ruby Regexps For Input Validation

19 Oct 2012

Ruby's regular expressions have an idiosyncrasy that can get you in trouble when doing input validation. Find out how to avoid this common gotcha in this post.

Some White Spaces are More Equal Than Others

23 Jul 2012

Let's not argue about tabs vs. spaces. Let's argue about spaces vs. spaces!

My Favorite Bundler Feature

03 Jul 2012

Ruby's popular gem bundling library made dependency management headaches a thing of the past, but it also bundles another feature that has changed my day-to-day life for the better: open

Enumerable's *ect Methods Reimplemented Using `each_with_object`

20 May 2012

On episode 54 of the Ruby Rogues podcast, Josh Susser mentioned an interview question he used to use where he would ask the interviewee to reimplement Enumerable's *ect methods (collect, select, reject, and detect) using inject. In this post I attempt the same thing, but using each_with_object

Confessions of a Meteor Newb

23 Apr 2012

I spent a weekend building a game with the brand new Meteor JavaScript Framework. Lessons learned and all that.

Dead Simple Rails Config

04 Apr 2012

Adding custom configuration to a Rails app used to be a chore, but now it's dead simple. Here's how.

A Simple Pattern to Namespace and Selectively Execute Certain Bits of JavaScript Depending on Which Rails Controller and Action are Active

08 Feb 2012

The title says it all

Building Multi-tenant Rails Apps with PostgreSQL Schemas

18 Jul 2011

There are a few different ways to go about building a multi-tenant Rails application. One way that works really well for certain apps is to use PostgreSQL's 'schemas' feature to partition each tenant's data. This article lays out why you might want to build your multi-tenant app this way and how to go about it.

cap db:pull

29 Jun 2011

A quick and dirty capistrano task to pull a snapshot of your (PostgreSQL) production database into your development environment.

Connecting Node.js to Redis To Go on Heroku

17 Jun 2011

Heroku's new Cedar stack is awesome for many reasons, one of which is first-class Node.js hosting. I'm giving it a test run with an app that uses Redis for data caching and I couldn't find any documentation on how to connect a Node app to the Redis To Go add-on. Here's how I did it

Pow and Apache Side-by-Side

12 Apr 2011

Pow is the new hotness for serving up Ruby apps in development. Apache is the old standby for serving up PHP (and other) apps in development. Pow and Apache don't play nice, but we can change that.

ActiveRecord Association Caching Gotcha

07 Apr 2011

Updating a related object in an ActiveRecord callback can be tricky due to association caching. It tripped me up for too long and Google was not helpful. Hopefully this post will at least solve the unhelpful Googling problem.

The Perfect Setup: Rails on Screen

25 Feb 2011

This post isn't trying to sell you on screen. There are umpteen sites out there which do that. Instead, I'd like to share with you how I've engineered my setup such that it's a joy to use.

jQuery: isInArray Boolean Sugar

31 Jan 2011

Sprinkle this sugary function on top of your jQuery for a little syntactic delight.

Bridging the Gap Between JavaScript's console.log and Cocoa's NSLog

27 Dec 2010

Working with JavaScript inside of a WebKit WebView can be tricky because bare-bone WebViews don't ship with the handy, dandy developer console that is available in Safari and Chrome. In this post, I outline how to get your JavaScript console.logs to show up in Xcode's Debugger Console using NSLog.

The Tech Behind the New Grooveshark

15 Dec 2010

In which I pay respect to the many open source libraries we used as foundation for Grooveshark's new web-based player.

Making Rails 3's Mail Gem and Paperclip Play Nice

09 Dec 2010

The old TMail gem used in Rails allowed directly importing parsed attachments into Paperclip. The new Mail gem works differently, but we can make them play nice.

Testing Cappuccino Notifications

07 Jan 2010

Writing a web app using Cappuccino has a lot of benefits, one of which is a really nice message passing system wherein certain objects can register to observe events and take action when other objects post notifications of those events.


02 Dec 2009

Most of the online regular expression testers I've used just aren't that useful, but Rubular is the exception.

280 Atlas Introductory Screencast

16 Nov 2009

The much anticipated 280 Atlas developer beta is under way and I recorded a brief screencast introducing the basic concepts of creating applications with Atlas.

Just Abort It

24 Aug 2009

Ruby's `abort` method may be just what you need to print a message and exit.

Self-Scheduling Ruby Scripts

20 Aug 2009

I have a lot of Ruby scripts running on different servers all scheduled via cron and it's quite easy to forget what script is scheduled when and how often. This can be worked around with `Whenever`.

Amending Git Commits

16 Aug 2009

I recently learned that you can fix you're previous commit (modify commit message, add more files, etc.) quite easily with git.

Ad Hoc Rails Console Logging

18 Jul 2009

If you want to be able to toggle your development log between the default Rails logger and the console, just add this method to your `~/.irbrc`

Sass Never Forgets

09 Jul 2009

A Sass mixin for centering a div on a page horizontally and vertically.

jQuery Tools 101: Nested Tabs

01 Jul 2009

If you want to nest tabs inside one another you'll need to change things slightly. I demonstrate in this post.

Let Capistrano Compile Ruby 1.9 For You

02 Jun 2009

A Capistrano task to install Ruby 1.9.1 to `/opt/ruby-1.9.1` on Debian

Dead Simple Rails Deployment

31 May 2009

A couple of technologies have come along and made my deployment process a whole lot easier.

Create Arbitrarily Sized Files In Less Than 15 Lines of Ruby

22 May 2009

With this little Ruby script, you can arbitrarily generate files of any size (using 1MB increments).

jQuery: Open External Links In New Window/Tab

18 May 2009

Use jQuery to add the target attribute to links so it doesn't muck up the HTML.

Expand Your Twitter Network In Less Than 15 Lines of Ruby

17 May 2009

Let's use Ruby to generate a list of people highly followed by our friends.

See Which Twitterers Don't Follow You Back In Less Than 15 Lines of Ruby

12 May 2009

See Which Twitterers Don't Follow You Back In Less Than 15 Lines of Ruby

jQuery: Set Mouse Focus On Page Load

09 May 2009

How to set the mouse's focus to an element on the page when the DOM is ready, using jQuery

Extending TMail::Mail for HTML and plaintext only

21 Feb 2009

A project I'm working on required a little more from Ruby's TMail library than it offers out of the box.

A simple Ruby method to send email

17 Feb 2009

Feel free to use this simple method to send email

Date Range Goodies in Rails

27 Aug 2008

When it comes to dealing with dates and their formats between different databases, Ruby, time zones, etc, etc…it can get pretty nasty...

Easy Configuration with Ruby and Yaml

19 Aug 2008

Even trivial apps need to be configured. Why not use Yaml?

Ruby to the Rescue

18 Aug 2008

Walking through the basic usage of Ruby's `rescue` feature

jQuery Wizard Redux

09 Aug 2008

I was interested in creating a step-by-step form wizard for a Rails app I’ve been working on, so naturally I began searching for a jQuery plugin or tutorial. The best thing I could find was a ‘plugin’ written back in June of 2007...

Rails + Screen = Awesome

24 Jul 2008

Unix’s `screen` utility is like pow-pow-power wheels for remote shells.

Pass Optional Arguments to Ruby Method

24 Jul 2008

Ruby makes it super-simple to pass optional arguments with default values.

Traversing Directories with Ruby

15 Jul 2008

A few quick tips on traversing directories with Ruby.

Capify - public key deployment

11 Jul 2008

I’ve been playing with Capistrano a lot lately and loving it. Here is an example of how easy it is to write tasks and use them on multiple remote servers.

Rails: Nested Layouts

20 Jun 2008

Sometimes one layout (application.html.erb) just doesn’t cut it, but you don’t want a separate layout for each controller in your app. You can use the following technique to nest your Rails app’s layouts.

git clone & pull without changing directories

19 May 2008

If you’re trying to configure git commands in a directory that isn’t `pwd`, you’ll have to deal with `clone` and `pull` a little differently.