Skip to content

Instantly share code, notes, and snippets.

View STAR-ZERO's full-sized avatar

Kenji Abe STAR-ZERO

View GitHub Profile
@STAR-ZERO
STAR-ZERO / FontFitTextView.java
Created June 15, 2012 03:18
【Android】横幅に合わせてテキストサイズを調整するTextView
import android.content.Context;
import android.graphics.Paint;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.widget.TextView;
/**
* サイズ自動調整TextView
*
*/
@STAR-ZERO
STAR-ZERO / .zshrc
Created June 9, 2012 15:31
PROMPTに顔文字(oh-my-zshのrobbyrussellテーマに追加)
#顔文字固定で色ランダム
PROMPT=$'%{\e[$[32+$RANDOM % 5]m%}(。◕‿◕。)%{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
#顔文字も色もランダム
FACE_CHAR=("(。◕‿◕。) " "(・∀・)ノ " "( ゚Д゚) " "(。╹ω╹。)" "♡♡♡♡" "☆☆☆☆")
PROMPT=$'%{\e[$[32+$RANDOM % 5]m%}$FACE_CHAR[$[$RANDOM % ${#FACE_CHAR[@]} + 1]]%{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
@STAR-ZERO
STAR-ZERO / bundletool
Created May 14, 2018 05:50
shell script for bundletool
#!/bin/sh
dir=$(dirname $0)
java -jar "$dir/bundletool-all-0.3.3.jar" $@
@STAR-ZERO
STAR-ZERO / build.gradle
Last active May 2, 2018 06:40
support libraryのバージョンコンフリクト対応
def supportLibraryVersion = '27.1.1'
android {
// ...
defaultConfig {
// ...
multiDexEnabled true
}
@STAR-ZERO
STAR-ZERO / build.gradle
Created April 11, 2018 16:09
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation'. の警告で compile を使ってるライブラリを探すGradleタスク
task searchCompileDependencies() {
doLast {
configurations.find { it.name == 'compile' }?.dependencies?.each {
println "$it.group:$it.name"
}
}
}
@STAR-ZERO
STAR-ZERO / activity_main.xml
Created March 8, 2018 05:28
BottomAppBarのサンプル
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_anchor="@id/toolbar"
tools:context=".MainActivity">
<android.support.design.widget.AppBarLayout
@STAR-ZERO
STAR-ZERO / SampleFragment.java
Created December 13, 2012 03:44
【Android】Fragmentのテンプレート的なもの
public class SampleFragment extends Fragment {
/** Fragmentで保持しておくデータ */
private int mData;
/**
* Fragmentインスタンスを生成した返却.
*
* コンストラクタに引数を渡すのはダメ。
* Fragmentがメモリ不足で破棄され、そこから復帰する時に空のコンストラクタ呼ばれる。
def robolectricDependenciesFolder = project.rootDir.path + "/.robolectric-dependencies"
configurations.create('robolectricRuntime')
dependencies {
robolectricRuntime "org.robolectric:android-all:o-preview-4-robolectric-0"
}
rootProject.task(type: Copy, overwrite: true, "downloadRobolectricDependencies") {
from configurations.robolectricRuntime
@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 / memo.md
Last active December 14, 2016 08:55
nginx + unicorn + capistrano設定

nginx + unicorn + capistrano設定メモ

Nginx

起動

$ nginx

停止