Skip to content

Instantly share code, notes, and snippets.

View takuo's full-sized avatar

Takuo Kitame takuo

  • Bandai Namco Studios, Inc.
  • Saitama, Japan
  • 09:50 (UTC +09:00)
View GitHub Profile
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"os"
"strconv"
)
@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 / amazonlink.user.js
Created September 26, 2012 07:28
アマゾンの商品リンクコピペ用
@takuo
takuo / AndroidManifest.xml
Created March 6, 2012 10:13
共有(Intent.ACTION_SEND)で受け取ったテキストをクリップボードにぶち込むだけのアプリ
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="jp.takuo.android.sharetoclipboard"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="4" />
<application
android:icon="@drawable/ic_launcher"
@takuo
takuo / AndroidManifest.xml
Created February 28, 2012 10:59
twicca plugin - share a status url
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" android:theme="@android:style/Theme.Translucent">
<activity
android:label="@string/activity_name"
android:name=".TweetLinkShare">
<intent-filter>
<action android:name="jp.r246.twicca.ACTION_SHOW_TWEET" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
@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;
@takuo
takuo / MyActivity.java
Created October 18, 2011 07:23
Android code snippet - using IntentService
public void onClick(View v) {
startService(new Intent(this, MyService.class));
}
@takuo
takuo / gist:1294791
Created October 18, 2011 07:13
Android code snippet - using AsyncTask
public void onClick(View v) {
new DownloadImageTask().execute("http://example.com/image.png");
}
private class DownloadImageTask extends AsyncTask<String, Void, Bitmap> {
/** The system calls this to perform work in a worker thread and
* delivers it the parameters given to AsyncTask.execute() */
protected Bitmap doInBackground(String... urls) {
return loadImageFromNetwork(urls[0]);
}
@takuo
takuo / gist:1294790
Created October 18, 2011 07:12
Android code snippet - using Thread
public void onClick(View v) {
new Thread(new Runnable() {
public void run() {
final Bitmap bitmap = loadImageFromNetwork("http://example.com/image.png");
mImageView.post(new Runnable() {
public void run() {
mImageView.setImageBitmap(bitmap);
}
});
}
@takuo
takuo / twitter-oauth.rb
Created August 24, 2011 01:52
Twitterのoauthしてaccess tokenを取得するだけのスクリプト
#!/usr/bin/ruby
#
# usage:
# ./twitter-oauth.rb <CONSUMER_KEY> <CONSUMER_SECRET> <user> <password>
#
require 'rubygems'
require 'oauth'
CONSUMER_KEY=ARGV[0]
CONSUMER_SEC=ARGV[1]