Skip to content

Instantly share code, notes, and snippets.

View STAR-ZERO's full-sized avatar

Kenji Abe STAR-ZERO

View GitHub Profile
# atom-sync-settings
@STAR-ZERO
STAR-ZERO / SamplePermissionActivity.java
Created October 9, 2015 07:21
【Android】Marshmallow以降の権限チェックサンプル
public class SamplePermissionActivity extends AppCompatActivity {
// ...
private static final int PERMISSIONS_REQUEST_READ_PHONE_STATE = 1;
private void checkPermission() {
if (ContextCompat.checkSelfPermission(this, Manifest.permission.READ_PHONE_STATE) != PackageManager.PERMISSION_GRANTED) {
// 許可されてない

HomebrewでPostgreSQL

インストール

$ brew install postgresql

初期化

@STAR-ZERO
STAR-ZERO / gist:d5e1c6dfbd825d98cecb
Created February 5, 2015 04:52
複数のOptionalをunwrap
import Foundation
func unwrap2<T1, T2>(a: T1?, b: T2?) -> (T1, T2)? {
switch (a, b) {
case (let .Some(a), let .Some(b)):
return (a, b)
default:
return nil
}
}
@STAR-ZERO
STAR-ZERO / Resize iOS Image Directory.jsx
Last active August 29, 2015 14:10
iOSで@3xの画像から@1x@2xの画像にリサイズするPhotoshopスクリプト
// フォルダを指定して一括リサイズ
function resizeImage(file, destFolder) {
try {
var doc = open(file, OpenDocumentType.PNG)
if (doc == null) {
throw "Something is wrong with the file. Make sure it's a valid PNG file.";
}
@STAR-ZERO
STAR-ZERO / gist:ab2ee83c829b9dc2e219
Created November 27, 2014 06:01
AppExtensionを含むアプリのTestFlightへのアップロード
#! /bin/sh
# TestFlight upload notes
while getopts "m:" opts
do
case $opts in
m)
NOTES=$OPTARG ;;
esac
done
@STAR-ZERO
STAR-ZERO / B2DebugDrawLayer.cpp
Created August 20, 2014 02:09
Cocos2d-xでBox2DのDebugDraw
#include "B2DebugDrawLayer.h"
USING_NS_CC;
B2DebugDrawLayer *B2DebugDrawLayer::create(b2World *pB2World, float pPtmRatio)
{
B2DebugDrawLayer *pRet = new B2DebugDrawLayer(pB2World, pPtmRatio);
if (pRet && pRet->init()) {
pRet->autorelease();
return pRet;
@STAR-ZERO
STAR-ZERO / gist:5a8e9fac5e78d7980de0
Created August 5, 2014 14:54
AnsibleからVagrantにアクセスするための設定

AnsibleからVagrantにアクセスするための設定

Vagrant側の設定

IPアドレスを設定しておく

config.vm.network "private_network", ip: "192.168.33.10"
@STAR-ZERO
STAR-ZERO / GestureView.h
Last active August 29, 2015 14:04
GestureRecognizerで移動、拡大・縮小、回転
#import <UIKit/UIKit.h>
@interface GestureView : UIView <UIGestureRecognizerDelegate>
@end
@STAR-ZERO
STAR-ZERO / proguard-rules.pro
Created July 19, 2014 16:59
ActiveAndroidのProGuard設定
-keep public class com.activeandroid.** { *; }
-keep public class * extends com.activeandroid.Model
-keepattributes *Annotation*