Skip to content

Instantly share code, notes, and snippets.

View danmayer's full-sized avatar

Dan Mayer danmayer

View GitHub Profile
# local run with the sleep
#real 12m30.294s
# on devver with the sleep
#real 1m53.353s
require 'rubygems'
require 'test/unit'
require 'puzzle'
require 'pp'
require 'permutations'
def depends_on_pending_migrations_if_exists
task = 'db:abort_if_pending_migrations'
begin
Rake::Task[task].invoke
rescue RuntimeError
#noop this is not a rails project don't depend on this task
end
end
desc "A task I want considitonally dependant on migrations if this project is a rails project"
1) Failure:
test: with a version should create gemspec with some dependencies. (VersionTest)
[/test/unit/version_test.rb:143:in `__bind_1256771802_829589'
vendor/bundler_gems/gems/shoulda-2.10.2/lib/shoulda/context.rb:351:in `call'
vendor/bundler_gems/gems/shoulda-2.10.2/lib/shoulda/context.rb:351:in `test: with a version should create gemspec with some dependencies. '
vendor/bundler_gems/gems/activesupport-2.3.4/lib/active_support/testing/setup_and_teardown.rb:62:in `__send__'
vendor/bundler_gems/gems/activesupport-2.3.4/lib/active_support/testing/setup_and_teardown.rb:62:in `run']:
<"RubyGem89"> expected but was
<"RubyGem90">.
@danmayer
danmayer / fake_test.rb
Created November 5, 2009 14:25
a test for various code metric analyzers
#just using this to trigger various warnings in reek, flay, saikuro, etc
#trying to trigger churn warning
desc "Perform some benchmarking against the production site"
task :benchmark do
puts "starting benchmarking"
fork_and_print("ab -c 100 -t 130 -n 1000 -r http://site.com/")
fork_and_print("ab -c 100 -t 130 -n 1000 -r http://site.com/contact")
fork_and_print("ab -c 100 -t 130 -n 1000 -r http://site.com/documentation/how_it_works\
")
@danmayer
danmayer / api_examples.rb
Created November 5, 2009 16:11
a few examples of using the devver.net Caliper API
#This is a few examples of how to use the devver.net Caliper API
require 'cgi'
require "uri"
require "restclient"
require 'ruby-debug'
require 'json'
class CaliperAPI
# example of the configurations that can be passed to Caliper
# place this file in the root or config/ of your project
# and overide the settings as needed
directories_to_calculate: ---
- app
- lib
- docs
- src
# example of the configurations that can be passed to Caliper
# name this file Caliper.yml
# place this file in the root or config/ of your project
# and overide the settings as needed
#this is an example for git://github.com/jcbozonier/DfaStringMatcher.git
directories_to_calculate: ---
- Source
@danmayer
danmayer / example_redcar_caliper.yml
Created December 24, 2009 17:34
and example Caliper.yml for redcar
# example of the configurations that can be passed to Caliper
# name this file Caliper.yml
# place this file in the root or config/ of your project
# and overide the settings as needed
#this is an example for _redcar
directories_to_calculate: ---
- plugins
~/projects/churn(master) > churn
dyld: lazy symbol binding failed: Symbol not found: _rb_intern2
Referenced from: /Users/danmayer/.rvm/gems/ruby-1.9.1-p378/gems/json-1.2.0/ext/json/ext/parser.bundle
Expected in: flat namespace
dyld: Symbol not found: _rb_intern2
Referenced from: /Users/danmayer/.rvm/gems/ruby-1.9.1-p378/gems/json-1.2.0/ext/json/ext/parser.bundle
Expected in: flat namespace
Trace/BPT trap
~/projects/churn(master) > which churn
/Users/danmayer/.rvm/gems/ruby-1.9.1-p378/bin/churn
mv /opt/local/bin/churn /opt/local/bin/bak_churn
~/projects/churn(master) > churn
-bash: /opt/local/bin/churn: No such file or directory
~/projects/churn(master) > which churn
/Users/danmayer/.rvm/gems/ruby-1.9.1-p378/bin/churn