This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ActiveRecord::Batches | |
def find_in_batches(options = {}) | |
relation = self | |
unless arel.orders.blank? && arel.taken.blank? | |
ActiveRecord::Base.logger.warn("Scoped order and limit are ignored, it's forced to be batch order and batch size") | |
end | |
if (finder_options = options.except(:start, :batch_size)).present? | |
raise "You can't specify an order, it's forced to be #{batch_order}" if options[:order].present? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=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') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Bash snippet to open new shells in most recently visited dir. | |
# Useful if you want to open a new terminal tab at the present | |
# tab's location. | |
# | |
# Put this in your .bashrc or whatever. | |
pathed_cd () { | |
if [ "$1" == "" ]; then | |
\cd | |
else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/Gemfile b/Gemfile | |
index fd90d42..9dd0146 100644 | |
--- a/Gemfile | |
+++ b/Gemfile | |
@@ -1,4 +1,6 @@ | |
source 'http://rubygems.org' | |
+gem 'perftools.rb', '>= 0.4.4' | |
+gem 'rack-perftools_profiler' | |
gem 'rails', '3.0.0.rc' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# unicorn_rails -c /data/github/current/config/unicorn.rb -E production -D | |
rails_env = ENV['RAILS_ENV'] || 'production' | |
# 16 workers and 1 master | |
worker_processes (rails_env == 'production' ? 16 : 4) | |
# Load rails+github.git into the master before forking workers | |
# for super-fast worker spawn times | |
preload_app true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ActionController | |
module Caching | |
module Fragments | |
def read_fragment_with_comment(name, options) | |
fragment = read_fragment_without_comment(name, options) | |
fragment && "\n<!-- cache-hit: #{name} -->\n#{fragment}\n<!-- /cache-hit: #{name} -->\n" || nil | |
end | |
alias_method_chain :read_fragment, :comment |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sudo su - | |
# mkdir /etc/resolver | |
# cat > /etc/resolver/test | |
nameserver 127.0.0.1 | |
port 2155 | |
^D | |
^D | |
$ brew install dnsmasq | |
$ dnsmasq --port=2155 --no-resolv --address=/.test/127.0.0.1 | |
$ ping foo.test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
desc "cache assets" | |
task :cache_assets => :environment do | |
paths = ['public/javascripts/all.js', 'public/stylesheets/all.css'] | |
puts "-----> caching assets..." | |
paths.each do |path| | |
puts "-----> #{path}" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module CpuProf | |
require 'ffi' | |
extend FFI::Library | |
ffi_lib FFI::CURRENT_PROCESS | |
begin | |
attach_function :start, :ProfilerStart, [:string], :void | |
attach_function :stop, :ProfilerStop, [], :void | |
rescue FFI::NotFoundError => e | |
STDERR.puts "*** Are you sure you preloaded libprofiler?" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Tienda gratis de La Piluka | |
Plaza de Corcubión, 16 | |
Metro: B. del Pilar/Peñagrande | |
Bus: 147, 42, 49, 83, 132 | |
Tienda gratis de La Prospe | |
c/ Luís Cabrera 19 | |
91 562 70 19 | |
Metro: Prosperidad o Avda. América. |
OlderNewer