Skip to content

Instantly share code, notes, and snippets.

View ichiban's full-sized avatar

Yutaka Ichibangase ichiban

View GitHub Profile
@ichiban
ichiban / how-to-post-multipart-form-data-with-oauth.rb
Created July 11, 2011 04:50
How to post multipart/form-data with OAuth in Ruby
require 'oauth/consumer'
require 'net/http/post/multipart'
OAuth::VERSION = 1.0
consumer = OAuth::Consumer.new('consumer_key', 'consumer_secret',
:site => 'http://provider.example.com',
:request_token_path => '/request_token',
:authorize_path => '/authorize',
:access_token_path => '/access.token')
(require :fare-matcher)
;; Clojure or ML's function syntax style defun
(defmacro defunction (name &body body)
(flet ((match-clause (clause)
(cons `(list ,@(car clause)) (cdr clause))))
(let ((args (gensym)))
`(defun ,name (&rest ,args)
(fare-matcher:ematch ,args