Skip to content

Instantly share code, notes, and snippets.

@zhengjia
zhengjia / capybara cheat sheet
Created June 7, 2010 01:35
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@codegoalie
codegoalie / bingo.rb
Created February 5, 2011 23:45
Computes pseudo-random bingo cards to fill with a list of items
puts "How many players?"
players = gets.chomp.to_i
puts "How many items?"
items = gets.chomp.to_i
(1..players).each do |i|
puts "card #{i}"
card = Array.new
(1..5).each do |row|
print " "
(1..5).each do |col|
@Chris927
Chris927 / generic_repo.rb
Created August 21, 2011 09:51
Repository Ideas (DDD style) for Rails
module GenericRepo
def self.included(base)
base.class_eval do
extend ClassMethods
end
end
module ClassMethods
attr_accessor :model
def create(params)
@emartini
emartini / config.ru
Created February 2, 2012 15:20
Mount Resque server in Rails 2.3 app
#Autor: emartini
require ::File.expand_path('../config/environment', __FILE__)
require "resque/server"
app_name = Rack::Builder.new do
use Rails::Rack::LogTailer
use Rails::Rack::Static
run ActionController::Dispatcher.new
end
@simi
simi / Gemfile
Created February 7, 2012 14:32
Refinery + Twitter Bootstrap WIP
source 'https://rubygems.org'
gem 'rails', '3.2.1'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
@cypriss
cypriss / README.md
Last active June 18, 2018 11:57
Rails 2.3.14 Ruby 1.9.3 - Monkey Patches

How we upgraded UserVoice, a Rails 2.3.14 app, to Ruby 1.9.3.

Blog post here

@coreyhaines
coreyhaines / .rspec
Last active August 15, 2024 15:13
Active Record Spec Helper - Loading just active record
--colour
-I app
@oodavid
oodavid / README.md
Created March 26, 2012 21:21
Restore MySQL from Amazon S3

Restore MySQL from Amazon S3

This is a hands-on way to pull down a set of MySQL dumps from Amazon S3 and restore your database with it

Sister Document - Backup MySQL to Amazon S3 - read that first

1 - Set your MySQL password and S3 bucket, make a temp dir, get a list of snapshots

# Set our variables

export mysqlpass="ROOTPASSWORD"

@thegrubbsian
thegrubbsian / deploy.rake
Created June 13, 2012 17:22
Heroku Deploy Rake Task
namespace :deploy do
HEROKU_ACCOUNT = "account_name"
MAINLINE_BRANCH = "master"
STAGING_REPO = "app-name-staging"
PRODUCTION_REPO = "app-name-production"
def make_git_timestamp
"#{@env}-deploy-#{Time.now.to_s.gsub(/:/, "-").gsub(/\s/, "-").gsub(/--/, "-")}"
end
(function(global) {
var silpUrl = '//s3-eu-west-1.amazonaws.com/silp.shootitlive.com/js/silp.min.js';
// Globals
if(!global.Silp) { global.Silp = {}; };
var Silp = global.Silp;
// To keep track of which embeds we have already processed
if(!Silp.foundEls) Silp.foundEls = [];