Skip to content

Instantly share code, notes, and snippets.

View jherdman's full-sized avatar

James Herdman jherdman

View GitHub Profile
irb(main):030:0> columns.zip(values).each do |col, val|
irb(main):031:1* puts "(#{col}, #{val})"
irb(main):032:1> end
("id", 2)
("program_id", 4)
("version", NULL)
("title", 'Level 2 Intake Questionnaire Part 1')
("description", 'Stage 2 intake questionnaire')
("duplicate_allowed", 0)
("css_path", NULL)
# parses out the current branch you're on. See: http://www.harukizaemon.com/2008/05/deploying-branches-with-capistrano.html
current_branch = `git branch`.match(/\* (\S+)\s/m)[1]
# use the branch specified as a param, then use the current branch. If all fails use master branch
set :branch, ENV['branch'] || current_branch || "master" # you can use the 'branch' parameter on deployment to specify the branch you wish to deploy
/Users/james/Projects/active_admin/spec/spec_helper.rb:9:in `load_defaults!': uninitialized constant ActiveAdminIntegrationSpecHelper::Category (NameError)
from /Users/james/Projects/active_admin/spec/spec_helper.rb:104:in `<top (required)>'
from /Users/james/Projects/active_admin/spec/integration/default_namespace_spec.rb:1:in `require'
from /Users/james/Projects/active_admin/spec/integration/default_namespace_spec.rb:1:in `<top (required)>'
from /Users/james/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/rspec-core-2.9.0/lib/rspec/core/configuration.rb:746:in `load'
from /Users/james/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/rspec-core-2.9.0/lib/rspec/core/configuration.rb:746:in `block in load_spec_files'
from /Users/james/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/rspec-core-2.9.0/lib/rspec/core/configuration.rb:746:in `map'
from /Users/james/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/rspec-core-2.9.0/lib/rspec/core/configura
@jherdman
jherdman / have_status_code.rb
Created February 27, 2013 16:53
An RSpec matcher for checking HTTP response codes from a Rails Controller
RSpec::Matchers.define :have_status_code do |expected|
match do |response|
response.status == expected
end
description do
"be #{expected} (#{lookup_human_code(expected)})"
end
failure_message_for_should do |actual|
@jherdman
jherdman / README.md
Last active January 11, 2022 05:49 — forked from ankane/README.md
A Gem loading benchmark script

Benchmark Bundler

Because loading gems can take longer than you think

$ curl -fsSL https://gist.github.com/jherdman/5025684/raw/a3ccd4b5308723245706b4ae315845fe951b4473/benchmark.rb | ruby
............................................................[DONE]

Gem                            Time(sec)     Pct %
--------------------------------------------------
POST params ^D^H[ i^D^L^S<DA>^Tf^Z1352475110.6091139^@<FB><B9>f^X1352475170.60676^@<D5>([0o:^YNewRelic::MetricDat:^K@statso:%NewRelic::ScopedMethodTraceStats^L:^T@sum_of_squaresf4205170941750112e-06:^Z@total_exclusive_timef^Z0.00119
18544769287109:^S@max_call_timef^Z0.0011918544769287109:^U@total_call_timef^Z0.0011918544769287109:^S@min_call_time@^M:^T@unscoped_statso:^_NewRelic::MethodTraceStats^Kf^F0; f^F0;
f^F0;^Kf^F0;^Lf^F0:^P@call_counti^@;^Oi^F:^O@metric_idi^D^OG] :^Q@metric_spec0o;^@^H;^Fo;^N^Kf00022667996978498195; f^X0.01013493537902832;
f^X0.01505589485168457;^Kf^X0.01505589485168457;^L@^Y;^Oi^F;^Pi^D<92><F7>8 ;^Q0o;^@^H;^Fo;^N^Kf^W32297.425064086914; f^Q179.71484375;
f^Q179.71484375;^Kf^Q179.71484375;^L@^_;^Oi^F;^Pi^Dp!6 ;^Q0o;^@^H;^Fo;^N^Kf024687590123505743^@@; f^Y0.099820137023925781;
f^X0.15712285041809082;^Kf^X0.15712285041809082;^L@%;^Oi^F;^P0;^Qo:^YNewRelic::MetricSpec^G:^K@scope"^@:
@name"$Controller/user_sessions/createo;^@^H;^Fo;^N^Kf40959999999999985^@C*;
@jherdman
jherdman / import.js
Created February 7, 2012 18:18
Redis Insertion Experiment
#!/usr/bin/env node
var redis = require('redis')
, client = redis.createClient()
, numEntries = parseInt(process.argv[2], 10)
, paused = false
, numKeys
, key
, set;
@jherdman
jherdman / experiment.js
Created February 7, 2012 07:11
Redis insertion experiment with Node
#!/usr/bin/env node
var redis = require('redis')
, client = redis.createClient()
, numEntries = parseInt(process.argv[2], 10)
, paused = false
, numKeys
, key
, set;
#!/usr/bin/env ruby
require 'hiredis'
require 'redis'
redis = Redis.new
num_entries = ARGV.shift.to_i
puts "Flusing existing entries"
redis.flushall
~proj/zeppelin [develop]➜ git push origin :feature/return-response-object
remote: /data/github/current/lib/github/config/resque.rb:27: undefined method `constantize' for "GitHub::Jobs::RepositoryUpdateLanguage":String (NoMethodError)
remote: from /data/github/current/lib/github/config/resque.rb:26:in `each'
remote: from /data/github/current/lib/github/config/resque.rb:26
remote: from /data/github/current/lib/rock_queue.rb:9:in `require'
remote: from /data/github/current/lib/rock_queue.rb:9
remote: from hooks/post-receive:27:in `require'
remote: from hooks/post-receive:27
To [email protected]:jherdman/zeppelin.git
- [deleted] feature/return-response-object