Skip to content

Instantly share code, notes, and snippets.

View mag's full-sized avatar

Mike Grafton mag

  • Citizen Code
  • Oakland
View GitHub Profile
sudo yum install mysql-devel
sudo gem install mysql -- --with-mysql-config=/usr/lib/mysql/mysql_config
@mag
mag / .emacs
Created November 22, 2008 15:07
installing ruby-mode.el on mac osx leopard
; ruby
;; based on http://www.rubygarden.org/Ruby/page/show/InstallingEmacsExtensions
;;
(add-to-list 'load-path "~/.emacs.d/site-lisp/ruby")
(autoload 'ruby-mode "ruby-mode"
"Mode for editing ruby source files")
(add-to-list 'auto-mode-alist '("\\.rb$" . ruby-mode))
(add-to-list 'interpreter-mode-alist '("ruby" . ruby-mode))
@mag
mag / test.rb
Created November 24, 2008 04:41
pedroia:jrubytest mag$ jruby calculate_year.rb
JRuby limited openssl loaded. gem install jruby-openssl for full support.
http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL
STARTING 1
STARTING 2
after Foo, thread 1
/Users/mag/dev/jruby-1.1.5/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:428:in `load_missing_constant': Expected /Users/mag/dev/jrubytest/app/models/foo.rb to define Foo (LoadError)
from /Users/mag/dev/jruby-1.1.5/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:77:in `const_missing_with_dependencies'
from /Users/mag/dev/jruby-1.1.5/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:89:in `const_missing'
from calculate_year.rb:11
def test_monthly_distribution
pv_module = sunpower_module
distribution = pv_module.generation_for_month(tmy3_stations(:fake_station), 5, 35, 225)
assert_equal 24, distribution.size
assert_equal 4755.38, distribution[13].precision(2)
assert_equal 36523.42, distribution.sum.precision(2)
end
def add_define(name)
$defs.push("-D#{name}")
end
add_define 'BUILD_FOR_RUBY'
add_define 'HAVE_RBTRAP' if have_var('rb_trap_immediate', ['ruby.h', 'rubysig.h'])
add_define "HAVE_TBR" if have_func('rb_thread_blocking_region')# and have_macro('RUBY_UBF_IO', 'ruby.h')
GNU_CHAIN = true
OS_UNIX = true
add_define 'OS_UNIX'
The problem with the above is that the two rspec "worlds" get mixed together. Despite passing a separate Options object to
my rpsec builder, it ends up using the same Reporter object as the spec itself! So at the end of the run rspec reports that
it ran 2 specs - the one run by RspecBuilder and the one run by the spec itself.
@post_bodies = []
stub.proxy(Net::HTTP).new do |new_net_http|
stub(new_net_http).request do |request|
if request.method.downcase.to_sym == :post
@post_bodies << request.body
end
end
end
@post_bodies = []
stub.proxy(Net::HTTP).new do |new_net_http|
stub(new_net_http).request do |request|
if request.method.downcase.to_sym == :post
@post_bodies << request.body
end
end
end
require 'rubygems'
require 'jazz_money'
JazzMoney::Runner.from_jasmine_config.call