Skip to content

Instantly share code, notes, and snippets.

View mculp's full-sized avatar
🎨
arting

Matt Culpepper mculp

🎨
arting
  • Mississippi
  • 02:38 (UTC -05:00)
  • X @mculppp
View GitHub Profile
>> a = OpenStruct.new
=> #<OpenStruct>
>> h = OpenStruct.new
=> #<OpenStruct>
>> h.a = a
=> #<OpenStruct>
>> a.h = h
=> #<OpenStruct a=#<OpenStruct h=#<OpenStruct ...>>>
>> h.a.h.a.h.a.h.a.h.a.h.a.h.a.h.a.h
=> #<OpenStruct a=#<OpenStruct h=#<OpenStruct ...>>>
>> nineeleven = Date.parse('9/11/2001')
=> Tue, 11 Sep 2001
>> earthquake = Date.parse('3/10/2011')
=> Thu, 10 Mar 2011
>> Date.parse("#{nineeleven.month + earthquake.month}/#{nineeleven.day + earthquake.day}/#{nineeleven.year + earthquake.year - 2000}")
=> Fri, 21 Dec 2012
# aw fuck
>> c = CarSearch.last
=> #<CarSearch id: 906, start_date_time: "2011-03-30 12:00:00", ...>
>> cs = c.clone
=> #<CarSearch id: nil, start_date_time: "2011-03-30 12:00:00", ...>
>> cs.attributes
=> {"start_date_time"=>Wed Mar 30 12:00:00 -0500 2011, ...}
>> cs.read_attribute :start_date_time
activerecord:
errors:
messages:
some_blank_message: "Shit be blank"
mculp:rails matthew$ gem build rails.gemspec
Successfully built RubyGem
Name: rails
Version: 3.1.0.beta
File: rails-3.1.0.beta.gem
mculp:rails matthew$ rake install
(in /Users/matthew/work/rails)
(in /Users/matthew/work/rails/activesupport)
(in /Users/matthew/work/rails/activemodel)
Using rspec-rails (2.5.0)
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
mculp:greenpath matthew$ rails g rspec:install
identical .rspec
exist spec
conflict spec/spec_helper.rb
Overwrite /Users/matthew/work/greenpath/spec/spec_helper.rb? (enter "h" for help) [Ynaqdh] y
force spec/spec_helper.rb
Failure/Error: click_button 'submit'
Encoding::CompatibilityError:
incompatible encoding regexp match (UTF-8 regexp with ASCII-8BIT string)
# ./spec/integration/searches_spec.rb:16:in `block (2 levels) in <top (required)>'
matthew$ bundle exec rspec spec/models/search_spec.rb
/Library/Ruby/Gems/1.8/gems/bundler-1.0.12/lib/bundler/shared_helpers.rb:107:in `gem': rspec-core is not part of the bundle. Add it to Gemfile. (Gem::LoadError)
from /usr/bin/rspec:18
matthew$ bundle exec rspec spec/models/search_spec.rb
Could not find gem 'rspec-core (= 1.3.4, runtime)' in any of the gem sources listed in your Gemfile.
matthew$ bundle exec rspec spec/models/search_spec.rb
/Library/Ruby/Gems/1.8/gems/rspec-core-2.0.1/lib/rspec/core.rb:78:in `require': no such file to load -- rspec/expectations (LoadError)
from /Library/Ruby/Gems/1.8/gems/rspec-core-2.0.1/lib/rspec/core.rb:78
Installing nokogiri (1.4.4) with native extensions /usr/local/rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rubygems/installer.rb:483:in `rescue in block in build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)
/usr/local/rvm/rubies/ruby-1.9.2-p0/bin/ruby extconf.rb
checking for libxml/parser.h... no
-----
libxml2 is missing. please visit http://nokogiri.org/tutorials/installing_nokogiri.html for help with installing dependencies.
-----
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
require 'benchmark'
require 'forgery'
def new_ostruct_member(arg); end
def generate_data
(0..1000).map do |i|
{ "k#{i}" => "v#{i}" }
end.inject &:merge
end