This is a fairly common question, and there isn't a One True Answer.
These are the most common techniques:
There is something to be learned from a rainstorm. | |
When meeting with a sudden shower, you try | |
not to get wet and run quickly along the road. | |
By doing such things as passing under the eaves | |
of houses, you still get wet. When you are | |
resolved from the beginning, you will not be | |
perplexed, though you will still get the same | |
soaking. This understanding extends to all things. | |
Ghost Dog, Chapter 22, T01:32:25 (quoted from: Hagakure: The Book of the Samauri) |
# Gemfile | |
… | |
gem 'uuidtools' | |
… |
RSpec.configure do |config| | |
config.before(:suite) do | |
ActiveRecord::Base.establish_connection database['one'] | |
DatabaseCleaner.strategy = :deletion | |
ActiveRecord::Base.establish_connection config.database['two'] | |
DatabaseCleaner.strategy = :deletion | |
end | |
config.before(:each) do |
# WAIT! Do consider that `wait` may not be needed. This article describes | |
# that reasoning. Please read it and make informed decisions. | |
# https://www.varvet.com/blog/why-wait_until-was-removed-from-capybara/ | |
# Have you ever had to sleep() in Capybara-WebKit to wait for AJAX and/or CSS animations? | |
describe 'Modal' do | |
should 'display login errors' do | |
visit root_path |
#1 Install it (example of linking to RackSpace Cloud), ubuntu example | |
apt-get install duplicity | |
apt-get install python-setuptools | |
git clone git://github.com/rackspace/python-cloudfiles.git | |
python setup.py install | |
#2 Create a simple shell script (put this in a shell script) | |
export CLOUDFILES_USERNAME=YOURNAME | |
export CLOUDFILES_APIKEY=YOURKEY |
# | |
# WillPaginate renderer for will_paginate 2.3.16 to generate HTML code for Twitter Bootstrap | |
# Put this content in in your config/initializers/will_paginate.rb | |
module WillPaginate | |
module ViewHelpers | |
class BootstrapLinkRenderer < LinkRenderer | |
def to_html |
# Put this in Rakefile (doesn't matter where) | |
require 'benchmark' | |
class Rake::Task | |
def execute_with_benchmark(*args) | |
bm = Benchmark.measure { execute_without_benchmark(*args) } | |
puts " #{name} --> #{bm}" | |
end | |
alias_method :execute_without_benchmark, :execute |
/** | |
* Copyright 2012 Akseli Palén. | |
* Created 2012-07-15. | |
* Licensed under the MIT license. | |
* | |
* <license> | |
* Permission is hereby granted, free of charge, to any person obtaining | |
* a copy of this software and associated documentation files | |
* (the "Software"), to deal in the Software without restriction, | |
* including without limitation the rights to use, copy, modify, merge, |
module AllCacheKey | |
extend ActiveSupport::Concern | |
module ClassMethods | |
def cache_key | |
pluck("COUNT(*)", "MAX(updated_at)").flatten.map(&:to_i).join("-") | |
end | |
end | |
end |