Trying to use Rails CSRF protection on cached actions? Rack middleware to the rescue!

Posted by Jarrod on February 06, 2010

With the release of Rails 2.0 came some very nice security enhancements. Among those was CSRF (cross site request forgery) protection which is implemented via a token in a hidden field that gets baked into POST, PUT, or DELETE forms. When Rails is asked to render a page that contains a form with any of these methods it generates an authenticity token. This token is stored in the session object and rendered out to a hidden field in said form. Anytime Rails receives a POST, PUT or DELETE request to one of these actions it will ensure that it was given back the previously generated token or else raise an error and not execute the action. Continue reading…

git merge vs git rebase: avoiding rebase hell

Posted by Jarrod on August 19, 2009

Learning Git can be a pain in the ass sometimes (OFTEN). One feature that has continually caused me to pull hair while I was climbing the learning curve is git-rebase. Rebase is a very useful tool, but also gives you more than enough rope to hang yourself with. Several questions need to be answered to fully understand a rebase:

1. How exactly does rebase differ from merge?

2. When/Why should you use it instead of a merge?

3. When should you absolutely not use it?

Let’s begin…

Continue reading…

Blacksmithing: The creation of an 11-12th century Norman helmet

Posted by Jarrod on October 24, 2008

At the start of the fall semester I began a continuing education class at the New York School of Visual Arts - Advanced Metalworking. The goal for taking this class is to construct a 11-12th century Norman helmet for use in full contact western martial arts in the SCA. I am beginning this post over a month into the class as much of the initial class time was spent honing skills and techniques needed for smithing.

Continue reading…

Faking the funk: “Stub” authentication in a Rails Rspec Story

Posted by Jarrod on August 22, 2008

Last week a ran into a bit of an issue trying to write Rspec Stories for the app I am working on. The app in question depends on a remote service based authentication system. Creating “test” users on a remote user authentication service already running as production for other apps was not really an option. Getting around this proved to be problematic as Rspec Stories entire point is to test the “full stack”. Continue reading…

Merb CRUD - ie: how to properly destroy things

Posted by Jarrod on July 15, 2008

By now most Rails developers have come to know and love (or not?) RESTful resources and the controller code that implements them. For the most part Merb’s implementation of resources will be familiar and adheres to the same convention - GET safe creates, updates, destroys, a single base URI for a single resource, etc. Continue reading…

Headed to Portland!

Posted by Jarrod on May 22, 2008

So its finally official… I am headed out to RailsConf in Portland, OR next week!

VIM is good for your health!

Posted by Jarrod on April 14, 2008

Thanks to my good friend and mentor Jerry Jackson forcing me to practice every day until I grew to like it, I am a die hard VIM user. To me it is just a much faster way to write code and edit text in general.

Once upon a time I was suffering from repetitive stress injuries to my mouse hand from long hours of 3D modeling and graphic design. Once I started to move away from the creative side of things and more to development (and thus using VIM regularly) that all went away. Continue reading…

Fun with Ruby blocks, modules, class inheritance, and “super”

Posted by Jarrod on April 14, 2008

The situation: A class, it’s descendant, and a module included in the parent class all have a method of the same name. Calling super from the child’s method causes a call to the parent class and not the module… Continue reading…

Managing branches in SVN

Posted by Jarrod on September 01, 2007

Collection of old notes I created for dealing with the excruciating process of branching and merging in SVN using the svnmerge python script. Continue reading…

CSS: Pipe Delimited List Menus

Posted by Jarrod on July 18, 2007

First of all – what the heck is a “pipe”? The character referred to as a “pipe” (|), in Linux, Unix, or OSX, is used for redirecting the output of one terminal command into another (ex: ls | grep “something”). It is also very commonly used, albiet only for presentation, to delimit individual items of a site navigation or other menu. By now, any professional web developer knows that a menu of any sort belongs inside our good ole friend the unordered list. I won’t go into the benefits of using semantic markup here, but I do want to share my technique for achieving this very common menu style without adding any extra markup or unnecessary characters.

Continue reading…