Skip to content

Instantly share code, notes, and snippets.

View j5ik2o's full-sized avatar

Junichi Kato j5ik2o

View GitHub Profile
@j5ik2o
j5ik2o / gist:1702820
Created January 30, 2012 05:57
UIAlertView
NSStringEncoding enc;
NSError* error = nil;
NSString* html = [NSString stringWithContentsOfURL:url
usedEncoding:&enc
error:&error];
if (error){
UIAlertView* alertView = [[[UIAlertView alloc] initWithTitle:@"Error"
message:[error localizedDescription]
@j5ik2o
j5ik2o / gist:1703671
Created January 30, 2012 10:06
atlassian製品のDBユーザ及びDBの作り方(PostgreSQL)
createuser -PdE crowd
createdb -E UNICODE crowddb
@j5ik2o
j5ik2o / gist:1764033
Created February 8, 2012 01:28
別スレッドでタスクを逐次処理する方法
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
// ネタ元はこちら → http://d.hatena.ne.jp/language_and_engineering/20120205/p1
@j5ik2o
j5ik2o / gist:1786414
Created February 10, 2012 04:00
git:masterからsvn:trunkに同期する方法
# 前提:クローンしたgitリポジトリに対してsvnリポジトリを設定して同期を行う。
# 設定ファイルを編集のが手間。
$ git clone ssh://localhsot/repos/app.git app
# .git/config にSVNのリポジトリの設定を追加する
[svn-remote "svn"]
url = http://junichi_kato@svn-server
fetch = project/app/trunk:refs/remotes/trunk
branches = project/app/branches/*:refs/remotes/*
@j5ik2o
j5ik2o / gist:1786626
Created February 10, 2012 04:34
git:masterからsvn:trunkに同期する方法(その2)
# 前提:git-svnでクローンしたリポジトリで外部のリモートリポジトリを指定して同期する方法
# gitコマンドだけでsvnへ同期可能。
# git-svnでsvnリポジトリをクローンする
$ git svn clone -s http://svn-server/app/ app
# 最初の1回だけ設定する
app$ git remote add central ssh://git-server/app/central.git
# SVNリポジトリの最新情報を取得する
@j5ik2o
j5ik2o / gist:1786770
Created February 10, 2012 04:52
git:tagをsvn:tagとして作成する方法
# 事前にgitにtagを作成しておきリモートリポジトリにpushする
central$ git tag v1.0.0
central$ git push origin v1.0.0
# 最新のgitリモートリポジトリを取得する
git-to-svn$ git remote update
# central/v1.0.0があることを確認
git-to-svn$ git branch -a
remotes/central/v1.0.0
# central/v1.0.0に切り替える
.DS_Store
Thumnail.db
target/
lib_managed/
src_managed/
project/boot/
@j5ik2o
j5ik2o / rest.scala
Created February 24, 2012 15:54 — forked from stonegao/rest.scala
Basic RESTful service with Finagle
class Respond extends Service[Request, Response] with Logger {
def apply(request: Request) = {
try {
request.method -> Path(request.path) match {
case GET -> Root / "todos" => Future.value {
val data = Todos.allAsJson
debug("data: %s" format data)
Responses.json(data, acceptsGzip(request))
}
case GET -> Root / "todos" / id => Future.value {
@j5ik2o
j5ik2o / gist:1946981
Created March 1, 2012 03:18
scalaxbでNumberFormatExceptionになるケース
- XMLスキーマ
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:element name="hoge">
<xs:complexType>
<xs:sequence>
<xs:element ref="fuga"/>
</xs:sequence>
</xs:complexType>
</xs:element>
@j5ik2o
j5ik2o / gist:1976303
Created March 5, 2012 03:25
複数の名前空間に定義されるスキーマを別パッケージのオブジェクトとして生成したい

やりたいこと

複数の名前空間に定義されるスキーマを別パッケージのオブジェクトとして生成したい。sbtで。

build.sbt

packageName in scalaxb in Compile := "api.model"

sourceGenerators in Compile <+= scalaxb in Compile