Skip to content

Instantly share code, notes, and snippets.

Avatar

Martin Westin eimermusic

View GitHub Profile
@ahoward
ahoward / net-http-debug.rb
Created Dec 10, 2010
a simple way to debug tons of libs that use ruby's net/http
View net-http-debug.rb
BEGIN {
require 'net/http'
Net::HTTP.module_eval do
alias_method '__initialize__', 'initialize'
def initialize(*args,&block)
__initialize__(*args, &block)
@graza
graza / savon_response_body.rb
Created Dec 3, 2010
Monkey patch to get Savon to handle multipart responses
View savon_response_body.rb
module Savon
class Response
MIME_HEADER_PART = /^\s*(\w+)\s*=\s*(["']?)(.+)\2$/
def body
return @body if @body
@body = gzipped_body? ? decoded_body : @http.body
if @http['content-type'] =~ /^multipart\//i
# Parse the header to get the boundary
params = {}
@http['content-type'].split(/;/).each do |part|
View gist:439777
// Provides a device_scale class on iOS devices for scaling user
// interface elements relative to the current zoom factor.
//
// http://37signals.com/svn/posts/2407-device-scale-user-interface-elements-in-ios-mobile-safari
// Copyright (c) 2010 37signals.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell