Skip to content

Instantly share code, notes, and snippets.

View batter's full-sized avatar

Ben Atkins batter

View GitHub Profile
@batter
batter / active_model_dirty_changed_nil.rb
Created March 16, 2016 22:26
ActiveModel::Dirty attribute_name_changed? return values
begin
require 'bundler/inline'
rescue LoadError => e
$stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler'
raise e
end
gemfile(true) do
source 'https://rubygems.org'
# Activate the gem you are reporting the issue against.
@batter
batter / README.md
Last active January 10, 2016 23:58 — forked from mbostock/.block
Sortable Bar Chart

This variation of a simple bar chart adds sorting with staggered delay and translucency to improve readability during the transition. This technique is recommended by Heer & Robertson. Use the checkbox in the top right to turn sorting on or off.

# Activate the gem you are reporting the issue against.
gem 'activerecord', '4.0.10'
gem 'sqlite3', '1.3.9'
gem 'paper_trail', '3.0.6'
gem 'friendly_id', '5.0.4'
require 'active_record'
require 'minitest/autorun'
require 'logger'
# Activate the gem you are reporting the issue against.
gem 'rails', '3.2.17'
gem 'sqlite3', '1.3.9'
gem 'paper_trail', '3.0.0'
require 'active_record/railtie'
require 'action_controller/railtie'
require 'rails/test_help'
require 'logger'
# Activate the gem you are reporting the issue against.
gem 'railties', '4.1.0.rc1'
require 'minitest/autorun'
# Ensure backward compatibility with Minitest 4
Minitest::Test = MiniTest::Unit::TestCase unless defined?(Minitest::Test)
class BugTest < Minitest::Test
def test_require_statements
# Activate the gem you are reporting the issue against.
gem 'activerecord', '4.0.0'
require 'active_record'
require 'minitest/autorun'
require 'logger'
# This connection will do for database-independent bug reports.
ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: ':memory:')
ActiveRecord::Base.logger = Logger.new(STDOUT)
@batter
batter / rails_issue_12505_bug_report.rb
Created October 14, 2013 19:35
Bug report test created from the ActiveRecord template for gems for rails/rails#12505.
# Activate the gem you are reporting the issue against.
gem 'activerecord', '4.0.0'
require 'active_record'
require 'minitest/autorun'
require 'logger'
# This connection will do for database-independent bug reports.
ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: ':memory:')
ActiveRecord::Base.logger = Logger.new(STDOUT)
@batter
batter / rvmrc_gemset_list_comment_test.sh
Created January 31, 2012 22:30
RVM's .rvmrc file gemset case sensitivity test
source "/Users/batkins/.rvm/scripts/rvm" # status=0
rvm --version # status=0; match=/rvm 1.10.0/
mkdir ABC-abc # status=0
cd ABC-abc # status=0
rvm use 1.9.2@ABC-abc --rvmrc --create # status=0; match=/Using .*ruby-1.9.2-p290 with gemset ABC-abc/
rvm current # status=0; match=/ruby-1.9.2-p290@ABC-abc/
rvm gemset list # status=0; match=/=> ABC-abc/
cd ../ # status=0;
rvm gemset use global # status=0; match=/Using .*\/ruby-1.9.2-p290 with gemset global/
cd ABC-abc # status=0;
@batter
batter / rvmrc_list_comment_test.sh
Created January 31, 2012 20:45
RVM's .rvmrc files break `rvm list` output
source "/Users/batkins/.rvm/scripts/rvm" # status=0
rvm --version # status=0; match=/rvm 1.10.2/
mkdir ABC-abc # status=0
cd ABC-abc # status=0
rvm use 1.9.2@ABC-abc --rvmrc --create # status=0; match=/Using .*ruby-1.9.2-p290 with gemset ABC-abc/
rvm current # status=0; match=/ruby-1.9.2-p290@ABC-abc/
rvm list # status=0; match=/\* ree-1.8.7-2011.03/;match=/=> ruby-1.9.2-p290/
@batter
batter / gist:1534696
Created December 29, 2011 15:55
Demonstrating ActiveSupport's to_time method
(shell)
batkins: ~$: irb
1.8.7 :001> "12/10/11".to_time
NoMethodError: undefined method `to_time` for "12/10/11":String
from (irb):1
from :0
1.8.7 :002> # This demonstrates what you're talking about where it isn't finding the to_time method
1.8.7 :003> require 'rubygems'
=> true
1.8.7 :004> require 'active_support/all'