Patch for load speed: https://gist.github.com/1484985
cd /tmp
git clone git://gist.github.com/1484985.git
rvm install ruby-1.9.3-p0 --patch /tmp/1484985/cached_lp_sorted_lf.patch -n patched
Download fresh ruby-debug19
# MySQL. Versions 4.1 and 5.0 are recommended. | |
# | |
# Install the MySQL driver: | |
# gem install mysql2 | |
# | |
# And be sure to use new-style password hashing: | |
# http://dev.mysql.com/doc/refman/5.0/en/old-client.html | |
development: | |
adapter: mysql2 | |
encoding: utf8 |
# | |
# Put this in spec/support/ | |
# Will use a sunspot stub session as default in all tests. | |
# | |
# To actually test the search you'll need something like: | |
# describe "something", sunspot: true do | |
# ...some tests... | |
# end | |
# | |
# If you do this in your spec helper: |
namespace :deploy do | |
desc "Hot-reload God configuration for the Resque worker" | |
task :reload_god_config do | |
sudo "god stop resque" | |
sudo "god load #{File.join(deploy_to, 'current', 'config', 'resque-' + rails_env + '.god')}" | |
sudo "god start resque" | |
end | |
end | |
# append to the bottom: |
Patch for load speed: https://gist.github.com/1484985
cd /tmp
git clone git://gist.github.com/1484985.git
rvm install ruby-1.9.3-p0 --patch /tmp/1484985/cached_lp_sorted_lf.patch -n patched
Download fresh ruby-debug19
def screenshot | |
require 'capybara/util/save_and_open_page' | |
now = Time.now | |
p = "/#{now.strftime('%Y-%m-%d-%H-%M-%S')}-#{rand}" | |
Capybara.save_page body, "#{p}.html" | |
path = Rails.root.join("#{Capybara.save_and_open_page_path}" "#{p}.png").to_s | |
page.driver.render path | |
Launchy.open path | |
end |
ENV["RAILS_ENV"] = "test" | |
require File.expand_path('../../config/environment', __FILE__) | |
require 'rubygems' | |
gem 'minitest' | |
require 'minitest/autorun' | |
require 'action_controller/test_case' | |
require 'miniskirt' | |
require 'capybara/rails' |
# MOTIVATION: As rails apps are growing, people are noticing the drawbacks | |
# of the ActiveRecord pattern. Several apps I have seen, and several | |
# developers I have spoken to are looking towards other patterns for object | |
# persistence. The major drawback with ActiveRecord is that the notion | |
# of the domain object is conflated with what it means to store/retrieve | |
# it in any given format (like sql, json, key/value, etc). | |
# | |
# This is an attempt to codify the Repository pattern in a way that would | |
# feel comfortable to beginner and seasoned Ruby developers alike. | |
# |
let(:vehicle) { FactoryGirl.create(:vehicle, vehicle_attributes) } | |
let(:vehicle_attributes) { {} } | |
describe "#to_s" | |
subject { vehicle.to_s } | |
let(:vehicle_attributes) { {name: "Carzilla"} } | |
it { should == "Carzilla" } | |
end |
-- show running queries (pre 9.2) | |
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
FROM pg_stat_activity | |
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
ORDER BY query_start desc; | |
-- show running queries (9.2) | |
SELECT pid, age(clock_timestamp(), query_start), usename, query | |
FROM pg_stat_activity | |
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |