Skip to content

Instantly share code, notes, and snippets.

View mumoshu's full-sized avatar
🏠
Working from home

Yusuke Kuoka mumoshu

🏠
Working from home
View GitHub Profile
@mumoshu
mumoshu / update status via dispatch.twitter
Created December 15, 2009 16:12
update status via dispatch.twitter
// [scala]update status via dispatch.twitter
/*
* Download
* http://databinder.net/dispatch/Download
*
* Getting started
* http://databinder.net/dispatch/Stdout_Walkthrough
*
* API Reference
@mumoshu
mumoshu / [bug]org.mortbay.jetty.testing.HttpTester.parse
Created December 27, 2009 09:55
[bug]org.mortbay.jetty.testing.HttpTester.parse
HttpTester.parse causes an error when given a non-ISO8859 string...
http://markmail.org/message/tw2q4wmk5foiov7f#query:httptester%20utf-8+page:1+mid:tw2q4wmk5foiov7f+state:results
I ran into an interesting situation using the HttpTester class. The
basic problem is that the response from my servlet is encoded in UTF-8,
and the HttpTester.parse(String rawHTTP) uses ISO-8859 and platform
encoding for the string character encoding, which may not contain all
the needed code points. Also, HttpTester.getContent() uses platform
encoding to interpret the raw bytes of the parsed content, which may not
be right at all.
package jp.mumoshu.http;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import android.util.Log;
# プロセスのメモリ使用量を調べる
# RSSという項目がメモリ使用量(単位:KB)
$ ps alx | head -1 && ps alx | grep sawfish
1. HTMLのHEADタグ内に下記を記述(静的ページでも対応可能)
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
2. CSSを画面サイズによって切り替える
<!--[if !IE]>
<link rel="stylesheet" href="style_print.css" media="print" type="text/css" />
<link rel="stylesheet" href="style.css" media="screen and (min-device-width: 481px)" type="text/css" />
<link type="text/css" rel="stylesheet" media="only screen and (max-device-width: 480px)" href="style_mobile.css" />
<link rel="stylesheet" href="style_mobile.css" media="handheld" type="text/css" />
![endif]-->
1. Eclipse + PHP Development Toolsをインストール
http://www.eclipse.org/pdt/downloads/
"All-In-One Windows 32-bit"をダウンロード。
適当なフォルダに展開して、eclipse.exeが起動できれば完了。
2. XAMPPのインストール
http://www.apachefriends.org/jp/xampp-windows.html#2671
#!/usr/bin/ruby -Ku
require "rubygems"
require "json"
require "net/http"
require "uri"
require "delegate"
Net::HTTP.version_1_2
#!/usr/bin/ruby -Ku
require "test/unit"
require "src/reverse_geocoder.rb"
require "pp"
require "json"
module TestData
@@http_geocoder_response = <<JSON
{
/*
* 参考: http://blog.livedoor.jp/sawamur/archives/50450768.html
*/
var CIRCLE_IN_METERS = 40000000
/**
* 引数に渡した緯度における経度1秒の長さをメートル単位で返す
* @param {number} latitude -180~+180の緯度
*/
private String getAttributeValueThenInjectResources(AttributeSet attrs,
String name) {
String value = attrs.getAttributeValue(null, name);
if (value == null)
return "";
String[] tokens = value.split("/");
if (tokens.length == 2 && tokens[0].equals("@string")) {
Field field;
try {
field = R.string.class.getField(tokens[1]);