Skip to content

Instantly share code, notes, and snippets.

@hkurosawa
hkurosawa / database.php
Last active August 29, 2015 14:00
CakePHP 2.x database.php file to switch between database configuration settings based on file existence under app/Config directory
<?php
// CakePHP 2.x database.php file to switch between database configuration settings based on file existence under app/Config directory
/**
* This is core configuration file.
*
* Use it to configure core behaviour of Cake.
*
* PHP 5
*

#Platforms

  • 2.3.x Gingerbread
  • 4.0.x Ice Cream Sandwich
  • 4.1.x/4.2.x/4.3.x Jelly Bean
  • 4.4.x Kitkat
  • 4.5.x "L"

#Screen Sizes

  • "xlarge" screens are at least 960dp x 720dp
  • "large" screens are at least 640dp x 480dp
@hkurosawa
hkurosawa / gist:54c3df54f1007d6709dd
Last active August 29, 2015 14:04
Windowsに入れるツールのメモ - 思い出したら書く
@hkurosawa
hkurosawa / gist:c306f3fb84833c2b1207
Last active August 29, 2015 14:08
How to run ShairPort on Raspbian
$ cat /etc/debian_version
7.6
$ sudo apt-get update
$ sudo apt-get upgrade
# install dependencies
$ sudo apt-get install libssl-dev libavahi-client-dev libasound2-dev
# clone source
@hkurosawa
hkurosawa / gist:1335837
Created November 3, 2011 05:28
how to launch external browser on Android http://blog.imho.jp/2011/08/android.html
String uri_str;
Uri uri = Uri.parse(uri_str);
Intent i = new Intent(Intent.ACTION_VIEW, uri);
startActivity(i);
@hkurosawa
hkurosawa / pastor2keepass.py
Created November 3, 2011 04:00
converts pastor export tsv to KeePassX xml import
"""
converts pastor export tsv to KeePassX xml import
"""
import sys, time
from xml.sax.saxutils import *
header = """<!DOCTYPE KEEPASSX_DATABASE>
<database>
<group>
<title>Pastor Imports</title>
@hkurosawa
hkurosawa / gist:1357579
Created November 11, 2011 09:19
How to fetch some value from Info.plist
[[[NSBundle mainBundle] infoDictionary] objectForKey:@"myKey"]
@hkurosawa
hkurosawa / gist:1372685
Created November 17, 2011 08:25
AndEngine: using TimerHandler
public Scene onLoadScene() {
final Scene scene = new Scene();
scene.setBackground(new ColorBackground(0.09804f, 0.6274f, 0.8784f));
//TimerHandler(sec, autoReset, callback)
TimerHandler timerHandler = new TimerHandler(0.1f, true, this);
scene.registerUpdateHandler(timerHandler);
return scene;
}
@hkurosawa
hkurosawa / gist:1385951
Created November 22, 2011 15:35
Getting Launcheable Activity List on Android
public List<ResolveInfo> getLauncheableActivityList(PackageManager packageManager) {
Intent intent = new Intent(Intent.ACTION_MAIN, null);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
List<ResolveInfo> resolveInfoList = packageManager.queryIntentActivities(intent, 0);
return resolveInfoList;
}
@hkurosawa
hkurosawa / gist:1386000
Created November 22, 2011 16:00
Getting VersionCode and VersionName on Android
public int getVersionCode() {
int versionCode;
try {
PackageInfo pinfo = getPackageManager().getPackageInfo(getPackageName(), 0);
versionCode = pinfo.versionCode;
} catch (NameNotFoundException e) {
versionCode = -1;
}
return versionCode;
}