• Quick, simple, easy captcha for Sinatra apps

require 'rubygems'
require 'sinatra'
require 'sinatra/captcha'

get '/' do
  erb :captcha
end

post '/' do
  if captcha_pass?
    halt 401, "invalid captcha"
  else
    "passed!"
  end
end

Thank you to ERR THE BLOG for inspiration: http://errtheblog.com/posts/43-captchator-on-rails