Skip to content

Instantly share code, notes, and snippets.

View gabu's full-sized avatar
Working from Sapporo

Shoya Tsukada gabu

Working from Sapporo
View GitHub Profile
@gabu
gabu / gist:2707046
Created May 16, 2012 03:16
【Scala】Play 2.0 Scala で Option のネストを綺麗にしたい【初心者】
def gabu(id: String, bid: String) = Action {
Project.findOneByID(id) match {
case Some(project: Project) => Build.findOneByID(new ObjectId(bid)) match {
case Some(build: Build) =>
// etc...
Ok(views.html.gabu(build)
case None => NotFound
}
case None => NotFound
}
@gabu
gabu / gist:2232383
Created March 29, 2012 01:52
Start Play app using play console
import play.api._
Play.start(new Application(new java.io.File("."), getClass.getClassLoader, None, Mode.Dev))
@gabu
gabu / gist:1568798
Created January 6, 2012 03:28
グローバル変数を汚したくなくてその場でrequireして、さらにnewできるかなーと思って書いたら動いてビビった。Titanium 1.8.0.1にて。
var navGroup, rootWindow;
Ti.UI.setBackgroundColor('#fff');
rootWindow = Ti.UI.createWindow();
navGroup = Ti.UI.iPhone.createNavigationGroup({
window: new (require('ui/title_window').TitleWindow)()
});
rootWindow.add(navGroup);
rootWindow.open();
@gabu
gabu / Solver.java
Created September 12, 2011 07:35
GDD2011 DevQuiz スライドパズルのすごく素直な反復深化(IDDFS)ソルバーです。
package net.gabuchan.devquiz.slidingpuzzle;
import java.util.Arrays;
public class Solver {
private static final char[] pieces =
new char[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' };
private static final char UP = 'U';