Ben Woodall

Last of the freelance hackers - Greatest sword fighter in the world

Validating REST Queries With Rails

| Comments

api, rails

I’ve recently been working on a few RESTful API’s using Rails. One of the problems that I keep seeing with end users is that they usually don’t read the documentation very well and make simple mistakes when making specific requests and queries. This is easily solved with error handling and validation of the API. There are a few gems out there that will handle this sort of situation for you, but there’s already so much in Rails to help you get this done out of the box.

Go Learn

| Comments

Go

I’ve recently decided to pick up learning the Go programming language. Why Go? I don’t remember why. But I think I was interested in beefing up backend services for some of the webapps I deploy. Plus, the Gopher is kinda cool. Also, the language itself is very easy to read in a Ruby type way.

The one pain in the ass thing about Go is that, as of now, the resources for learning it are few and far between. So I figured, “Hey, why don’t I just write about the things I’m learning?” So, hey, I’m doing that.

Setup for Remote Pairing

| Comments

linux, pairing

I’ve been trying to get into the swing of things with pair programming lately. #pairwithme has been blowing up on Twitter, so buddying up with a fellow dev to learn(or teach) a thing or two is pretty easy.

I’ve seen a lot of different posts on how to get going with pair programming. Many of them suggest having another person ssh in to your computer and have at it. I like to keep remote work separate though AND I just happen to have a VPS for just such a thing. So let’s set up remote pair programming!

A Bit More Git

| Comments

git

I gave a lightning talk this week for my Intro to Rails class at UW and thought I’d share it.

OSX Rspec Autotest Notifications

| Comments

rspec, ruby

This uses growl notifications to alert you to your autotest status

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
module Autotest::Growl
  def self.growl title, msg, img, pri=0, stick=""
    system "growlnotify -n autotest --image #{img} -p #{pri} -m #{msg.inspect} #{title} #{stick}"
  end

  Autotest.add_hook :ran_command do |at|
    results = [at.results].flatten.join("\n")
    output = results.slice(/(\d+)\s+examples?,\s*(\d+)\s+failures?(,\s*(\d+)\s+pending)?/)
    if output =~ /[1-9]\sfailures?/
      growl "Test Results", "#{output}", '~/Dropbox/Photos/autotest/rails_fail.png', 2 #, "-s"
    else
      growl "Test Results", "#{output}", '~/Dropbox/Photos/autotest/rails_ok.png'
    end
  end
end