Installing Redis Server and Client on Mac OS X and Ubuntu
wget http://redis.googlecode.com/files/redis-0.900_2.tar.gz
tar xzvf redis-0.900_2.tar.gz
cd redis-0.900
make
mv redis-server /usr/bin/
mv redis-cli /usr/bin/
Written by Sean Behan on 06/17/2012
Testing current_user and Sessions with Sinatra and Rack Test
Assume you have your standard Sinatra application.
# app.rb
require 'sinatra'
configure do
enable :sessions
end
get '/' do
if session[:user_id]
"OK"
else
raise "NOT OK!"
end
end
To test this you need to make a re...
Written by Sean Behan on 08/22/2013
How to Handle Uploading Really Large Files in PHP
PHP has some default limits that do not work out of the box when you want to work with uploading very large files.
So there are a few configuration changes you have to make to the defaults that come with PHP. These are defined in you php.ini file.
The...
Written by Sean Behan on 09/20/2018
Validate Uniqueness on Join Tables in Rails
How to validate uniqueness in a :has_many :through relationship with Ruby on Rails. You'll need three models in this example List, Subscriber and ListSubscriber. A list has many subscribers and a subscriber has many lists. Simple enough. Running the follo...
Written by Sean Behan on 06/17/2012
Regular Expression for finding absolute URLs
Regular Expression for finding absolute URLs in a bunch of text... like a log file.
/(http:(.*?)\s)/
Written by Sean Behan on 06/17/2012