Skip to content

Instantly share code, notes, and snippets.

@startuml

start

if (Have an access token?) then (yes)
else (no)
  if (Have an refresh token?) then (yes)
    while (Request access token) is (error)
 if (retry?) then (yes)
@sys1yagi
sys1yagi / kotlin.md
Last active June 7, 2017 08:50
object, companion object, top level(package level)の使い分け

object

シングルトンの代替え (Dagger通さなくてもいいやつ)

companion object

staticの代替え

例えばHogeActivity.createIntent()など あと定数とかね

class A() {
init {
val s: String = getStr()
println("${s.length}") // java.lang.NullPointerException
}
fun getStr(): String {
return str
}

最初期 - 開発人数: 1人, リリース前

このフェーズはほぼすべてのことが唯一の開発メンバーのスキルとマインド次第で決まるので、チームとしてできることは極めて少ないです。また、この段階のプロジェクトはリリース前に捨てる可能性もあるので、導入コストの高い開発ツールはまだ必要ありません。

  • バージョン管理をしている
  • リポジトリへのアクセス権を広げた(上長やチームメイト、開発基盤的な組織に権限を渡しておく)
  • CIをセットアップし、最低限ビルドだけしている
  • コーディングスタイルガイドを用意した
  • (Androidの場合).idea/codeStyleSettings.xml を用意してスタイルガイドに沿ってフォーマットできるようにした
@rocboronat
rocboronat / PermissionGranter.java
Last active December 26, 2022 07:05
Tap the "allow" button while running an Android instrumental test using UIAutomator
package com.fewlaps.android.permissiongranter;
import android.app.Activity;
import android.content.pm.PackageManager;
import android.os.Build;
import android.support.test.uiautomator.UiDevice;
import android.support.test.uiautomator.UiObject;
import android.support.test.uiautomator.UiObjectNotFoundException;
import android.support.test.uiautomator.UiSelector;
import android.support.v4.content.ContextCompat;
@JakeWharton
JakeWharton / Java6.java
Last active May 28, 2022 16:14
A comparison between non-capturing and capturing expressions across Java 6, Java 8, Java 8 with Retrolambda, Kotlin with native function expressions, and Kotlin with Java SAM expression.
import java.util.Arrays;
class NonCapturing {
public static void main(String... args) {
run(new Runnable() {
@Override public void run() {
System.out.println("Hey!");
}
});
}
@JakeWharton
JakeWharton / GenericCovariants.java
Created January 7, 2016 06:32
Unlike synthetic accessor methods, these synthetic covariant methods are hard or impossible to kill. Generics anyone?
interface Thing<T> {
T thing();
}
class CharSequenceThing implements Thing<CharSequence> {
@Override public CharSequence thing() {
return "CharSequence!";
}
}
@JakeWharton
JakeWharton / CovariantReturnTypes.java
Created January 7, 2016 05:59
Covariant return types generate an extra method in bytecode. This compounds in each subclass further specializing the type.
interface Thing {
Object thing();
}
class CharSequenceThing implements Thing {
@Override public CharSequence thing() {
return "CharSequence!";
}
}
@pol
pol / set_iTerm_background.sh
Created January 11, 2011 01:42
Set the background color of iTerm based on RAILS_ENV
#!/usr/local/bin/bash
set_term_bgcolor(){
local R=$1
local G=$2
local B=$3
/usr/bin/osascript <<EOF
tell application "iTerm"
tell the current terminal
tell the current session