Skip to content

Instantly share code, notes, and snippets.

View soupmatt's full-sized avatar

Matt Campbell soupmatt

View GitHub Profile
@soupmatt
soupmatt / vcr-webmock-2.rb
Last active May 10, 2018 20:45 — 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
#
@soupmatt
soupmatt / SSL_for_POW.md
Last active August 29, 2015 14:24
SSL for pow using nginx

Instructions

  • Install pow: http://pow.cx/
  • Install nginx: brew install nginx
  • download and run powssl
  • copy powssl.conf to /usr/local/etc/nginx/servers
  • restart nginx
  • copy org.nginx.pow.ssl.plist to /Library/LaunchDaemons (as root)
  • Run the following to get port 443 working
  • If you are on Yosemite or later:
@soupmatt
soupmatt / patch.rb
Last active August 29, 2015 14:14
Make ActiveRecord 4.1 aware of native postgresql enums
# PostgreSQL enums support (adapted from https://coderwall.com/p/azi3ka)
# Should be fixed in Rails >= 4.2 (https://github.com/rails/rails/pull/13244)
# put this code in an initializer file
raise "Remove this patch!" if Rails.version >= "4.2.0"
module ActiveRecord
module ConnectionAdapters
class PostgreSQLAdapter
module OID
class Enum < Type
def type_cast(value)
class BaseDaemon
attr_reader :logger
def initialize
@stopping = false
@logger = ::Logger.new(STDOUT)
@ending_thread = Thread.new do
Thread.stop
logger.info "Received a signal in #{name}"
@soupmatt
soupmatt / Gemfile
Created January 16, 2012 21:50
BUNDLE_WITHOUT Heroku Cedar fix
gem 'rails'
# hack to make heroku cedar not install special groups
def hg(g)
(ENV['HOME'].gsub('/','') == 'app' ? 'test' : g)
end
group hg(:cucumber) do
gem 'cucumber-rails'
gem 'capybara'
@soupmatt
soupmatt / freetds.conf
Created August 16, 2011 20:39
Freetds Example File, works with freetds 0.82 installed by homebrew
[global]
tds version = 8.0
text size = 645120
@soupmatt
soupmatt / zzz_pow.conf
Created July 1, 2011 13:51
Apache reverse proxy config for pow
<VirtualHost *:80>
ServerName pow
ServerAlias *.dev
ServerAlias *.xip.io
ProxyPass / http://localhost:20559/
ProxyPassReverse / http://localhost:20559/
ProxyPreserveHost On
</VirtualHost>
@soupmatt
soupmatt / bundle_check_install.sh
Created May 24, 2011 20:47
Sick of how long bundle install takes, just to find out you don't need any new gems?
#!/bin/bash
bundle check
if [[ $? = 1 ]] ; then
bundle install $@
fi
@soupmatt
soupmatt / config.ru
Created May 24, 2011 16:31
Passenger Rack::UrlMap Bug
require 'rack'
require 'rack/lobster'
use Rack::ShowExceptions
use Rack::CommonLogger
map '/fails' do
run Rack::Lobster.new
end
map 'http://localhost:3000/works' do