require "rails_helper"
describe "Speed Test" do
it "uses fixtures" do
10.times do
users(:brad)
end
end
This file contains hidden or 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
ruby -e '`open https://duckduckgo.com/?q=!ducky+bach+bwv+#{rand(1..1126)}+-gould+site%3Ayoutube.com`' |
This file contains hidden or 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
class Signup | |
include ActiveModel::Model | |
attr_accessor :email, :team_name | |
validates :email, presence: true | |
validates :team_name, presence: true | |
def save | |
return false unless valid? |
This file contains hidden or 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 SignalTrapper | |
def self.trap(*args, &block) | |
Signal.trap(*args, &block) | |
end | |
def self.trap_or_warn(*args, &block) | |
trap(*args, &block) | |
rescue ArgumentError => e | |
warn e | |
end |
This file contains hidden or 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
class FooController < ApplicationController | |
before_filter :user_required! | |
before_filter :admin_required!, :only => [:secret] | |
def not_secret | |
end | |
def secret | |
end | |
end |
This file contains hidden or 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
def redefine_constant(full_const_name, value) | |
parent_class, const_name = *parse_constant_namespace(full_const_name) | |
orig = parent_class.const_get(const_name).dup | |
parent_class.send(:remove_const, const_name) | |
parent_class.const_set(const_name, value) | |
yield | |
parent_class.send(:remove_const, const_name) |
This file contains hidden or 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
# Current: Resque#inline without block | |
begin | |
Resque.inline = true | |
Resque.enqueue 'Job' | |
ensure | |
Resque.inline = false | |
end | |
# New: Resque#inline with block | |
Resque.inline do |