# Gemfile
gem 'activeadmin'
gem 'switch_user'
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 within_navbar(&block) | |
| within('.navbar', &block) | |
| end | |
| def within_navbar_dropdown(&block) | |
| within_navbar do | |
| find(:css, '.dropdown-toggle').click | |
| within('.dropdown-menu', &block) | |
| 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
| class User | |
| attr_accessor :name | |
| def initialize(name); @name = name; end | |
| end | |
| class Collection | |
| include Enumerable | |
| def initialize(*elements) | |
| @elements = elements |
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
| require 'benchmark' | |
| require 'fileutils' | |
| require 'debugger' | |
| def N(&block) | |
| 100_000.times(&block) | |
| end | |
| CASES = { | |
| 'class-definition' => [ |
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
| diff --git a/grammar.y b/grammar.y | |
| index 3a76026..f05caf4 100644 | |
| --- a/grammar.y | |
| +++ b/grammar.y | |
| @@ -13,6 +13,7 @@ token TRUE FALSE NIL | |
| token IDENTIFIER | |
| token CONSTANT | |
| token END | |
| +token WHILE | |
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 ActiveRecord::Base | |
| def self.pluck_uniq(name, order = name) | |
| select(name.to_s).uniq.order(order).pluck(name.to_sym) | |
| 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
| vagrant@rails-dev-box:/vagrant/rails$ bundle exec rake test | |
| /home/vagrant/.rvm/rubies/ruby-2.0.0-p247/bin/ruby -w -I"lib:test" -I"/home/vagrant/.rvm/gems/ruby-2.0.0-p247@global/gems/rake-10.1.0/lib" "/home/vagrant/.rvm/gems/ruby-2.0.0-p247@global/gems/rake-10.1.0/lib/rake/rake_test_loader.rb" "test/**/*_test.rb" | |
| /home/vagrant/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/openssl/ssl.rb:101: warning: assigned but unused variable - id | |
| Run options: --seed 35377 | |
| # Running: | |
| ....................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................... |
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
| puts ObjectSpace.each_object(Class){} | |
| $LOAD_PATH.each do |dir| | |
| Dir[File.join(dir, '*.rb')].each do |path| | |
| lib = File.basename(path).gsub(/\.rb$/, '') | |
| next if %w(debug gauntlet_rubygems monitor dl profile).include?(lib) | |
| begin | |
| require lib | |
| rescue LoadError |
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
| require 'pp' | |
| require 'set' | |
| def class_count | |
| puts ObjectSpace.each_object(Class){} | |
| end | |
| SKIPS = %w(debug gauntlet_rubygems monitor dl profile).map{ |l| "#{l}.rb" } | |
| def require_all_the_things |