Skip to content

Instantly share code, notes, and snippets.

View jrafanie's full-sized avatar

Joe Rafaniello jrafanie

  • New Jersey
View GitHub Profile
From 54799c96a46237c101cc9290d89a86610a17d14c Mon Sep 17 00:00:00 2001
From: Joe Rafaniello <jrafanie@gmail.com>
Date: Tue, 4 May 2010 13:13:27 -0400
Subject: [PATCH] Squashed commit of the following:
commit a5f3f44c88e848f6862632e3f3587efb9bc9e4b9
Author: Joe Rafaniello <jrafanie@gmail.com>
Date: Tue May 4 13:03:47 2010 -0400
-Fixed transaction location to public methods.
@jrafanie
jrafanie / Debug akephalos console
Created September 8, 2011 15:50
Debug cucumber failures using akephalos console
Enhanced the idea found here:
http://railsdog.com/blog/2011/02/22/cucumber-testing-tips/
# Stop a feature/scenario at the point of a failure and drop into an rails console
# with access to the current page via akephalos with the application
# running, pre-transaction rollback, accessible in a browser on localhost:9887
#
# Usage:
# @wip @stop
# Scenario: change password
@jrafanie
jrafanie / Disabling eager loading effectively prevents autoloading
Created September 27, 2011 15:54
Disabling eager loading effectively prevents autoloading.
#install 3.1.1rc1
joerafaniello@:~/Code/playground/rails_3_1_stable$ gem install rails --pre
Successfully installed activesupport-3.1.1.rc1
Successfully installed activemodel-3.1.1.rc1
Successfully installed actionpack-3.1.1.rc1
Successfully installed activerecord-3.1.1.rc1
Successfully installed activeresource-3.1.1.rc1
Successfully installed actionmailer-3.1.1.rc1
Successfully installed railties-3.1.1.rc1
Successfully installed rails-3.1.1.rc1
@jrafanie
jrafanie / eager_test_patch_for_habtm.patch
Created September 30, 2011 22:31
When eager loading a HABTM and also including anything beyond it, everything in that result should have been queried for. Add passing tests that previously failed on Rails 2.3.8
From 03c1caefa04d9d22da31c02b6a137e76d43caf76 Mon Sep 17 00:00:00 2001
From: Joe Rafaniello <jrafanie@gmail.com>
Date: Fri, 30 Sep 2011 18:27:25 -0400
Subject: [PATCH] When eager loading a HABTM and also including anything
beyond it, everything in that result should have been
queried for. Add passing tests that previously failed on
Rails 2.3.8.
See https://rails.lighthouseapp.com/projects/8994/tickets/4831
---
@jrafanie
jrafanie / 20111109172903_create_users.rb
Created November 11, 2011 23:25
type column reader not defined for STI until you access the column using [:type], read_attribute(:type), or create a new instance.
class CreateUsers < ActiveRecord::Migration
def change
create_table :users do |t|
t.string :type
t.string :name
t.timestamps
end
end
end
@jrafanie
jrafanie / savon 0.9.8 compatibility
Created February 17, 2012 20:24
savon 0.9.8 breaks rubygems 1.3.7 compatibility on 1.8.7
~/Code/playground (master *) $ rvm use 1.8.7
Using /Users/joerafaniello/.rvm/gems/ruby-1.8.7-p358
~/Code/playground (master *) $ rvm gemset create savon
'savon' gemset created (/Users/joerafaniello/.rvm/gems/ruby-1.8.7-p358@savon).
~/Code/playground (master *) $ rvm use 1.8.7@savon
Using /Users/joerafaniello/.rvm/gems/ruby-1.8.7-p358 with gemset savon
~/Code/playground (master) $ gem install rubygems-update -v 1.3.7
@jrafanie
jrafanie / gist:2501904
Created April 26, 2012 18:49
Psych subclasses of String lose string value
diff --git a/test/psych/test_array.rb b/test/psych/test_array.rb
index 9eedbb4..5058676 100644
--- a/test/psych/test_array.rb
+++ b/test/psych/test_array.rb
@@ -25,7 +25,11 @@ module Psych
end
def test_subclass_with_attributes
- y = Psych.load Psych.dump Y.new.tap {|y| y.val = 1}
+ y = Y.new.tap {|y| y.val = 1}
@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
@jrafanie
jrafanie / gist:2853827
Created June 1, 2012 17:27
Psych hack to serialize instance variables in a Hash subclass.
From 4df445619ad6940058bb5a80f569e21f8ea370f6 Mon Sep 17 00:00:00 2001
From: Joe Rafaniello <jrafanie@gmail.com>
Date: Fri, 1 Jun 2012 12:17:40 -0400
Subject: [PATCH] Hack to serialize instance variables in a Hash subclass.
---
lib/psych/visitors/to_ruby.rb | 2 ++
lib/psych/visitors/yaml_tree.rb | 5 +++++
test/psych/test_hash.rb | 10 ++++++++++
3 files changed, 17 insertions(+)
@jrafanie
jrafanie / gist:2936844
Created June 15, 2012 14:54
Psych 8 times slower than Syck for YAML.load?
require 'benchmark'
require 'yaml'
yaml_str = <<-eos
---
hardware:
include:
volumes:
columns:
- name