Skip to content

Instantly share code, notes, and snippets.

@eik3
eik3 / sessiondecode.rb
Created August 19, 2010 15:50
A script to decode the Rails _session cookie
#!/usr/bin/env ruby
# This interactive script decodes the _session cookie contents of the Rails
# Session Store. It can be useful when debugging session-related problems.
# Be aware that Firefox doesn't update the cookie contents on every request when
# you keep the according dialog open. If you have to debug HTTP regularly, I can
# recommend the Charles Web Debugging Proxy (http://www.charlesproxy.com/)
puts("Loading...")
Signal.trap("INT") { puts "\n" ; exit }
@kylefox
kylefox / gist:1482281
Created December 15, 2011 18:44
Passenger uses wrong URL to download PCRE.
PCRE (required by Nginx) not installed, downloading it...
# wget -O /tmp/ubuntu-passenger-7717/pcre.tar.gz ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.12.tar.gz
--2011-12-15 18:38:20-- ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.12.tar.gz
=> `/tmp/ubuntu-passenger-7717/pcre.tar.gz'
Resolving ftp.csx.cam.ac.uk... 131.111.8.80
Connecting to ftp.csx.cam.ac.uk|131.111.8.80|:21... connected.
Logging in as anonymous ... Logged in!
==> SYST ... done. ==> PWD ... done.
==> TYPE I ... done. ==> CWD (1) /pub/software/programming/pcre ... done.
==> SIZE pcre-8.12.tar.gz ... done.
@witscher
witscher / gist:3011497
Created June 28, 2012 13:49
very, very simple HTTP POST upload app
# set max_body_size and http_basic_auth in your nginx config
require 'rubygems'
require 'sinatra'
get '/' do
"none ya business"
end
@ankane
ankane / README.md
Last active December 14, 2015 03:39 — forked from panthomakos/benchmark.rb

Benchmark Bundler

Because loading gems can take longer than you think

Now available as a gem - get it here

@artem-mindrov
artem-mindrov / tags_controller.rb
Last active December 15, 2015 10:49
Helper for testing jquery tokeninput with Selenium & Capybara
class TagsController < ApplicationController
before_filter :authenticate_user!
respond_to :json
def index
q = params[:tag]
if q =~ %r{,|;}
q.gsub!(%r{(,|;).*}, "")
ActsAsTaggableOn::Tag.find_or_create_by_name(q)
@leewaa
leewaa / rubymotion-specs.md
Created May 21, 2014 08:40
A small post about how I had been using rspec for rubymotion incorrectly and how it works properly.

Rubymotion notes

Testing

This line should be added to the app delegate didLaunchWithOptions method

class AppDelegate
  def application(application, didFinishLaunchingWithOptions:launchOptions)
 return true if RUBYMOTION_ENV == 'test'
@skmetz
skmetz / gilded_rose_test.rb
Last active May 30, 2017 18:42
Gilded Rose Test
# This simplest thing is to clone Jim's repo (https://github.com/jimweirich/gilded_rose_kata) and then
# put this file in the root directory.
gem 'minitest', '~> 4.7'
require "minitest/autorun"
require "minitest/reporters"
MiniTest::Reporters.use! MiniTest::Reporters::SpecReporter.new
require_relative './gilded_rose'