Skip to content

Instantly share code, notes, and snippets.

View rsutphin's full-sized avatar

Rhett Sutphin rsutphin

  • Human Practice, Inc.
  • Chicago, Illinois
View GitHub Profile
@rsutphin
rsutphin / build.yaml
Created May 26, 2010 21:52
Demonstrates ivy4r issues #6 and #4
gems:
- ivy4r
ivy:
settings.file: ivysettings.xml
define 'foo' do
Java.java.lang.System.setProperty("foo", "bar")
end
@rsutphin
rsutphin / mongrel-handled.txt
Created September 10, 2010 14:35
Example for rack/rack issue 52
# server running with `rackup -s mongrel multiple.ru`
$ curl -v http://127.0.0.1:9292/
* About to connect() to 127.0.0.1 port 9292 (#0)
* Trying 127.0.0.1... connected
* Connected to 127.0.0.1 (127.0.0.1) port 9292 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.20.0 (i386-apple-darwin10.3.0) libcurl/7.20.0 OpenSSL/0.9.8n zlib/1.2.5 libidn/1.18
> Host: 127.0.0.1:9292
> Accept: */*
@rsutphin
rsutphin / multiple.ru
Created September 10, 2010 16:23
Example for thin issue #20
run proc { |env|
[
200,
{ "Content-Type" => "text/plain", "X-Foo" => "Bar\nBaz" },
["Foo?\n"]
]
}
@rsutphin
rsutphin / .gitignore
Created January 23, 2011 22:55
Odd problem with decimal PKs and validation failures in ActiveRecord's save! on JRuby
Gemfile.lock
*.sqlite3
@rsutphin
rsutphin / Gemfile
Created April 1, 2011 16:13
Test case for JRuby/1.9 mode/bundler-for-gem problem
gemspec
@rsutphin
rsutphin / redirects.rb
Created July 6, 2011 16:27
Sinatra app that emits various kinds of 3xx redirects
require 'sinatra'
get '/' do
<<-HTML
<ul>
<li><a href="/301.html">301</a></li>
<li><a href="/302.html">302</a></li>
<li><a href="/303.html">303</a></li>
</ul>
HTML
@rsutphin
rsutphin / gist:1068941
Created July 7, 2011 05:39
Extract gmail SMTP password from OS X keychain (from Mail.app configuration)
# Will prompt the first time
`security find-internet-password -gs smtp.gmail.com 2>&1 | grep password`.
split(' ').last.gsub('"', '').strip
@rsutphin
rsutphin / duration_updater.rb
Created August 17, 2011 22:24
Demonstrating an issue round-tripping between Syck and Psych. Clone then run syck-psych-syck.sh.
# I'm not sure why but sometimes Syck is used for 'yaml' even under 1.9.2. This forces the issue.
Y =
if RUBY_VERSION =~ /1.9/
require 'psych'
Psych
else
require 'yaml'
YAML
end
@rsutphin
rsutphin / fakefs-encodings-test.rb
Created August 25, 2011 22:07
Demonstrating two encoding-related issues for fakefs
# encoding: UTF-8
def test(env)
fn = 'foo'
File.open(fn, 'w:UTF-8') { |f| f.write '☃' }
begin
puts "Read from #{env} file: #{File.read(fn, :encoding => 'UTF-8')}"
rescue => e