Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
cat .gitignore | egrep -v "^#|^$" | while read line; do
if [ -n "$line" ]; then
OLD_IFS=$IFS; IFS=""
for ignored_file in $( git ls-files "$line" ); do
git rm --cached "$ignored_file"
done
IFS=$OLD_IFS
fi
@hedgehog
hedgehog / LICENSE.txt
Created December 2, 2011 13:46 — forked from jed/LICENSE.txt
generate random UUIDs
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Jed Schmidt <http://jed.is>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@hedgehog
hedgehog / api_wrapper_spec.rb
Created November 29, 2011 20:30 — forked from mrchrisadams/api_wrapper_spec.rb
Using webmock and VCR together
describe ApiWrapper::Connection, "with retry enabled" do
before(:each) do
# connect to api
# the @api_wrapper object persists, across all the responses, and we set the number of retries
# on the ApiWrapper::Connection#get method here too, for when we call it further down in the spec.
@api_wrapper = ApiWrapper::Connection.new('stage.api_wrapper.com', APIWRAPPER_V2_API_KEY, APIWRAPPER_V2_PASSWORD, :retries => 2)
VCR.use_cassette("ApiWrapper_Connection/v2/raising unhandled errors") do
@hedgehog
hedgehog / development.rb
Created November 28, 2011 23:07 — forked from MyArtChannel/development.rb
Use Pry as IRB replacement in rails 3 console
# Add this to the end of your development.rb and add
#
# gem 'pry'
#
# to your Gemfile and run bundle to install.
silence_warnings do
begin
require 'pry'
IRB = Pry
@hedgehog
hedgehog / em-http-vcr.rb
Created November 25, 2011 21:35 — forked from igrigorik/em-http-vcr.rb
Mocking with WebMock and VCR
require 'rubygems'
require 'test/unit'
require 'em-http'
require 'vcr'
VCR.config do |c|
c.cassette_library_dir = 'fixtures/vcr_cassettes'
c.http_stubbing_library = :webmock
end
require File.dirname(__FILE__) + '/../foo_page'
describe FooPage do
before(:all) do
html = File.open(File.dirname(__FILE__) + '/../fixtures/foo.html').read
doc = Capybara.string(html)
@page = FooPage(doc)
end
@hedgehog
hedgehog / cookie_steps.rb
Created November 24, 2011 07:24 — forked from nruth/cookie_steps.rb
Testing login "remember me" feature with Capybara (rack::test or selenium) - deleting the session cookie (only)
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@hedgehog
hedgehog / ebs_raid.rb
Created November 11, 2011 03:59 — forked from tnine/ebs_raid.rb
Ebs raid mounting. Links to this jira issue http://tickets.opscode.com/browse/CHEF-2275
include Opscode::Aws::Ec2
#Auto locates and attached ebs devices based on the data bag they reside in. The following test cases need to be performed
# Create multiple resources with new node: PASS
#
# Re-attach multiple resources after a reboot: PASS
#
# Create resources across 2 runs. First run creates first raid set, second run re-attaches then creates: PASS
#
@hedgehog
hedgehog / papertrail_webhook_test.rb
Created November 10, 2011 07:40
Papertrail webhook test client - POSTs JSON to a log processing webhook
#!/usr/bin/ruby -w
# See http://help.papertrailapp.com/kb/how-it-works/web-hooks
require 'yajl'
require 'faraday'
class PapertrailWebhookRequest
def self.connection
Faraday::Connection.new