Skip to content

Instantly share code, notes, and snippets.

View takuo's full-sized avatar

Takuo Kitame takuo

  • Bandai Namco Studios, Inc.
  • Saitama, Japan
  • 23:43 (UTC +09:00)
View GitHub Profile
@takuo
takuo / nmagw.rb
Created December 29, 2012 13:49
nma http gateway
# -*- coding: utf-8 -*-
require 'oauth'
require 'json'
require 'sinatra/base'
require 'net/http'
class NmaGw < Sinatra::Base
set :logging, true
@takuo
takuo / OAuthVerify.java
Created October 20, 2011 09:05
Android code snippet - OAuth verifier process (with Twitter4J)
public class OAuthVerify extends Activity {
private static final String CONSUMER_KEY = "";
private static final String CONSUMER_SECRET = "";
private static final String CALLBACK_URL = "myoauthapp://oauthcallback/";
private Context mContext;
private WebView mWebView;
private Twitter mTwitter;
private RequestToken mRequestToken;
private AccessToken mAccessToken;
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"os"
"strconv"
)
@takuo
takuo / gist:282683
Created January 21, 2010 09:14
mime decode for ruby1.9
# mime decode for ruby 1.9
def mime_decode( input, out_charset = 'utf-8' )
while input.sub!(/(=\?[A-Za-z0-9_-]+\?[BQbq]\?[^\?]+\?=)(?:(?:\r\n)?[\s\t])+(=\?[A-Za-z0-9_-]+\?[BQbq]\?[^\?]+\?=)/, '\1\2')
end
begin
ret = input.sub!( /=\?([A-Za-z0-9_-]+)\?([BQbq])\?([^\?]+)\?=/ ) {
charset = $1
enc = $2.upcase
word = $3
word = word.unpack( { "B"=>"m*", "Q"=>"M*" }[enc] ).first