Skip to content

Instantly share code, notes, and snippets.

View jrafanie's full-sized avatar

Joe Rafaniello jrafanie

  • New Jersey
View GitHub Profile
@jrafanie
jrafanie / vcr-webmock-2.rb
Created October 26, 2017 13:22 — forked from glaszig/vcr-webmock-2.rb
converts vcr cassettes to webmock 2.0-compatible format
# converts URIs in vcr cassettes from uri-based basic auth
# to header-based basic auth to be compatible with webmock 2.0.
# it will create a basic auth header with an ERB tag
# to keep user and password be editable.
#
# Authorization: Basic <%= Base64.encode64("user:password").chomp %>
#
# may not work if using VCR's filter_sensitive_data.
# in that case use https://gist.github.com/ujh/594c99385b6cbe92e32b1bbfa8578a45
#
# Logfile created on 2017-03-06 17:12:44 -0300 by logger.rb/56504
[----] D, [2017-03-06T17:12:44.556723 #19943:2afa865b1980] DEBUG -- : PostgreSQLAdapter#log_after_checkout, connection_pool: size: 5, connections: 1, in use: 1, waiting_in_queue: 0
[----] D, [2017-03-06T17:12:44.680628 #19943:2afa865b1980] DEBUG -- : MiqServer Load (0.6ms) SELECT "miq_servers".* FROM "miq_servers" WHERE "miq_servers"."guid" = $1 LIMIT $2 [["guid", "dc4343be-02a7-11e7-a1b2-0242a89f1cd9"], ["LIMIT", 1]]
[----] D, [2017-03-06T17:12:44.750165 #19943:2afa865b1980] DEBUG -- :  (0.2ms) SELECT last_value FROM miq_databases_id_seq
[----] D, [2017-03-06T17:12:44.755576 #19943:2afa865b1980] DEBUG -- : MiqRegion Load (0.4ms) SELECT "miq_regions".* FROM "miq_regions" WHERE "miq_regions"."region" = $1 LIMIT $2 [["region", 0], ["LIMIT", 1]]
[----] D, [2017-03-06T17:12:44.789966 #19943:2afa865b1980] DEBUG -- : SettingsChange Load (0.4ms)
@jrafanie
jrafanie / boom.rb
Last active December 18, 2015 16:58 — forked from tenderlove/boom.rb
minitest-stub_any_instance fails with ruby 2.3.0-preview2
# Fork of the rspec boom.rb: https://gist.github.com/tenderlove/183d0d7244f2f2da32aa from https://github.com/rspec/rspec-mocks/issues/1042
# This one is for minitest.
# Run this with minitest/minitest-stub_any_instance, it will randomly fail in ruby 2.3.0-preview2 when the ".new" example runs last.
# It passes if the stub any instance test method happens last with:
#
# Running
# <UnboundMethod: SmallCircle(Circle)#area>
# ..
#
# It fails with
@jrafanie
jrafanie / gitremoteaddall.sh
Created April 27, 2012 16:03 — forked from mausch/gitremoteaddall.sh
Adds all github forks in the network for a particular repository - sed -r option (linux) is -E on mac
mainrepo="mausch/solrnet"
urls=$(curl -s "https://github.com/api/v2/json/repos/show/$mainrepo/network" | python -mjson.tool | grep "url" | grep -vi "$mainrepo" | sed -Ee 's/.*(https.*)".*/\1/')
for url in $urls; do
remote=$(echo $url | cut -d/ -f4)
giturl=$(echo $url | sed -Ee 's/https/git/;s/$/.git/')
git remote add $remote $giturl
done