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 / 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';
@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 / 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: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:2887872
Created June 7, 2012 09:38
Xcode 4.3.2 crash when put Date Picker on the Storyboard
Process: Xcode [924]
Path: /Applications/Xcode.app/Contents/MacOS/Xcode
Identifier: com.apple.dt.Xcode
Version: 4.3.2 (1177)
Build Info: IDEApplication-1177000000000000~6
Code Type: X86-64 (Native)
Parent Process: launchd [490]
Date/Time: 2012-06-07 18:29:13.447 +0900
OS Version: Mac OS X 10.7.4 (11E53)
@gabu
gabu / gist:3261742
Created August 5, 2012 04:49
ちゃんとArrayListの中身までデシリアライズできるから不思議!
public class CopyOfRecipe056Activity extends ListActivity {
ItemAdapter mAdapter;
ArrayList<Item> mItems;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (savedInstanceState == null) {
mItems = new ArrayList<Item>();
@gabu
gabu / gist:fa671ae685413baebab9
Created August 6, 2014 12:53
CMTimeMake vs CMTimeMakeWithSeconds
NSLog(@"%f", CMTimeGetSeconds(CMTimeMake(3.25, 1))); // 3.000000
NSLog(@"%f", CMTimeGetSeconds(CMTimeMake(3.25 * 100, 100))); // 3.250000
NSLog(@"%f", CMTimeGetSeconds(CMTimeMakeWithSeconds(3.25, 1))); // 3.000000
@gabu
gabu / gist:4530500
Created January 14, 2013 14:39
Arduino + USB Host Shield + Bluetooth ドングルでAndroidからBluetooth接続した時のシリアルモニタのログ
Remote Name: Galaxy Nexus
Connected to Device: FC:C7:34:B5:30:DA
Wait For Incoming Connection Request
Bluetooth pin is set too: 0000
Information request
SDP Incoming Connection Request
SDP Configuration Request
SDP Successfully Configured
Disconnected SDP Channel
HCI Disconnected from Device
<activity
android:name=".ui.MainActivity_"
android:label="@string/app_name"
android:uiOptions="splitActionBarWhenNarrow" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
@gabu
gabu / gist:7809690
Created December 5, 2013 17:29
Sidekiq command optioins
sidekiq [options]
-c, --concurrency INT processor threads to use
-d, --daemon Daemonize process
-e, --environment ENV Application environment
-g, --tag TAG Process tag for procline
-i, --index INT unique process index on this machine
-p, --profile Profile all code run by Sidekiq
-q, --queue QUEUE[,WEIGHT]... Queues to process with optional weights
-r, --require [PATH|DIR] Location of Rails application with workers or file to require
-t, --timeout NUM Shutdown timeout