Skip to content

Instantly share code, notes, and snippets.

@operando
operando / Dangerfile
Last active March 4, 2021 05:24
[Android] resにPNG画像が追加されたら、WebP or SVGに変更できないか検討してみよう!って言うDanger
png_files = (git.modified_files + git.added_files).uniq.select { |file| file.include?("res/") && file.end_with?('.png') && !file.end_with?('.9.png') }
png_files.each do |filename|
warn("該当のPNG画像をWebP or SVGに変更できないか検討してみましょう", file: filename, line: 0)
end
@operando
operando / gas.js
Last active May 29, 2021 07:20
Googleスプレッドシートで "=slack_id(email)" でメールアドレスからSlack IDを調べる独自関数をGoogle App Scriptで作る
var TOKEN = PropertiesService.getScriptProperties().getProperty("slack_api_token");
function slack_id(email) {
var user = lookupByEmailSlackUser(email);
if (user == undefined) {
return "該当アドレスのSlack名は見つかりませんでした"
}
return "@" + user.name
}
@operando
operando / test.java
Last active October 26, 2020 03:04
How to send empty array param with Retrofit
// Create RequestBody
FormBody.Builder builder = new FormBody.Builder();
List<String> additionalFields = ...;
if (additionalFields.isEmpty()) {
builder.add("additional_fields[]", "");
} else {
for (String additionalField : additionalFields) {
builder.add("additional_fields[]", additionalField);
}
}
class TimeoutInterceptor : Interceptor {
companion object {
const val CONNECT_TIMEOUT = "CONNECT_TIMEOUT"
const val READ_TIMEOUT = "READ_TIMEOUT"
const val WRITE_TIMEOUT = "WRITE_TIMEOUT"
}
@Throws(IOException::class)
@operando
operando / gist:dec40f8fe3b48c177781373e18478c61
Created October 3, 2017 09:30
Google Playからcom.android.vending.INSTALL_REFERRERで投げられるBroadcastのIntentの中身
10-03 18:19:15.740 D/InstallReferrerReceiver(28042): Intent { act=com.android.vending.INSTALL_REFERRER flg=0x10 pkg=com.os.operando.takosan cmp=com.os.operando.takosan/.InstallReferrerReceiver (has extras) }
10-03 18:19:15.740 D/InstallReferrerReceiver(28042): key : referrer
10-03 18:19:15.740 D/InstallReferrerReceiver(28042): value : referrer_test
10-03 18:19:15.740 D/InstallReferrerReceiver(28042): key : referrer_timestamp_seconds
10-03 18:19:15.740 D/InstallReferrerReceiver(28042): value : 1507022325
10-03 18:19:15.740 D/InstallReferrerReceiver(28042): com.android.vending.INSTALL_REFERRER
10-03 18:19:15.740 D/InstallReferrerReceiver(28042): com.os.operando.takosan
10-03 18:19:15.741 D/InstallReferrerReceiver(28042): referrer : referrer_test
@operando
operando / api-server.md
Created February 19, 2017 06:18 — forked from nulltask/api-server.md
ネイティブアプリ向け API サーバを作った時の経験談
@operando
operando / .zshrc
Last active November 13, 2016 02:53
peco select adb history
# adb history
function peco-select-adb-history() {
local tac
if which tac > /dev/null; then
tac="tac"
else
tac="tail -r"
fi
BUFFER=$(\history -n 1 | \
eval $tac | \
@operando
operando / runner-0.5-0.6-diff.java
Created September 9, 2016 05:22
com.android.support.test:runner runner 0.5-0.6-alpha-diff
diff -ru 0.5/android/support/test/filters/SdkSuppress.java 0.6-alpha/android/support/test/filters/SdkSuppress.java
--- 0.5/android/support/test/filters/SdkSuppress.java 2016-02-22 20:52:48.000000000 +0900
+++ 0.6-alpha/android/support/test/filters/SdkSuppress.java 2016-08-02 22:18:50.000000000 +0900
@@ -21,12 +21,20 @@
import java.lang.annotation.Target;
/**
- * Indicates that a specific test or class requires a minimum API Level to execute.
+ * Indicates that a specific test or class requires a minimum or maximum API Level to execute.
* <p/>
@operando
operando / rules0.5-0.6-diff.java
Created September 8, 2016 23:42
com.android.support.test:rules rules0.5-0.6-alpha-diff
diff -ru ../0.5/android/support/test/annotation/UiThreadTest.java android/support/test/annotation/UiThreadTest.java
--- ../0.5/android/support/test/annotation/UiThreadTest.java 2016-02-22 20:52:48.000000000 +0900
+++ android/support/test/annotation/UiThreadTest.java 2016-08-02 22:18:50.000000000 +0900
@@ -22,18 +22,14 @@
import java.lang.annotation.Target;
/**
- * This annotation should be used along with {@link android.support.test.rule.UiThreadTestRule}
- * or with any rule that inherits from it. When the annotation is present, the test method is
- * executed on the application's UI thread (or main thread).
package rx.playground;
import rx.Observable;
import rx.subjects.BehaviorSubject;
import rx.subjects.SerializedSubject;
public class Variable<T> {
private T value;
private final SerializedSubject<T, T> serializedSubject;