Skip to content

Instantly share code, notes, and snippets.

View jmatsu's full-sized avatar
🏠
Working from home

Jumpei Matsuda jmatsu

🏠
Working from home
View GitHub Profile
#!/usr/bin/env bash
set -eux
mkdir -p tmp || :
cd tmp
: "${size:=240}"
: "${img_size:=$size}"
@jmatsu
jmatsu / build.gradle
Last active December 11, 2018 07:49
bintray's maven repositories under Google, Android and Firebase
maven { url "https://android.bintray.com/android-tools/" }
maven { url "https://android.bintray.com/android-utils/" }
maven { url "https://android.bintray.com/android-support/" }
maven { url "https://android.bintray.com/android-jack/" }
maven { url "https://firebase.bintray.com/gradle/" }
maven { url "https://firebase.bintray.com/geofire/" }
maven { url "https://firebase.bintray.com/firebase-jobdispatcher/" }
maven { url "https://firebase.bintray.com/digits-migration-helper-android/" }
maven { url "https://firebase.bintray.com/maven/" }
maven { url "https://google.bintray.com/interactivemedia/" }
#!/usr/bin/env bash
set -eu
set -o pipefail
filter_files() {
local -r ref_name="$1"
# select files by TAB
git --no-pager diff --diff-filter=ACMU --name-only "$ref_name" | fzf -m
}
import android.app.Application
import android.os.Bundle
import android.view.View
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProviders
class MyDefaultFactory extends ViewModelProviders.DefaultFactory {
// constructor
private final Map<String, ViewModel> mMap = new HashMap<>();
@Nullable
private String onetimeCacheKey;
@MainThread
public void setKey(@NonNull String key) {
def loadProperties(filename, properties) {
file("$rootDir/$filename").withInputStream {
properties.load(it)
}
}
ext.properties = new Properties()
loadProperties("version.properties", ext.properties)
# properties.hogehoge
#!/usr/bin/env bash
set -eu
main() {
local -r workspace="____movie2gif"
local -r movie_filename="$1"
local -r ratio="$2%"
local -r frameRate="$3"
local -r output_filename="${movie_filename%.*}.gif"
@jmatsu
jmatsu / LintIssureRegistory.java
Created January 5, 2017 02:21 — forked from kgmyshin/LintIssureRegistory.java
RxJava2SubscribeOnErrorDetector
package com.kgmshin.lint;
import com.android.tools.lint.client.api.IssueRegistry;
import com.android.tools.lint.detector.api.Issue;
import java.util.Collections;
import java.util.List;
public class LintIssueRegistry extends IssueRegistry {
import android.support.v7.preference.Preference
import android.graphics.Bitmap
import android.graphics.drawable.BitmapDrawable
import android.graphics.drawable.Drawable
import com.squareup.picasso.Target
import java.lang.ref.WeakReference
private class PreferenceTarget(pref: Preference) : Target {
private val ref: WeakReference<Preference?> = WeakReference(pref)
class SettingFragment : PreferenceFragmentCompat() {
companion object {
fun newInstance(rootKey: String?): SettingFragment = SettingFragment().apply {
arguments = Bundle().apply {
putString(PreferenceFragmentCompat.ARG_PREFERENCE_ROOT, rootKey)
}
}
}
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {