Skip to content

Instantly share code, notes, and snippets.

View takahirom's full-sized avatar

Takahiro Menju takahirom

View GitHub Profile
@queq1890
queq1890 / main.ts
Last active May 27, 2023 01:55
Create a new pull request with empty commit using @octokit/rest
import { Octokit } from '@octokit/rest';
type Option = {
owner: string;
repo: string;
baseBranch: string;
newBranch: string;
pullRequest: {
title: string;
body: string;
@manuelvicnt
manuelvicnt / AnAndroidApp.kt
Last active January 1, 2023 17:05
Hilt and AssistedInject working together in Hilt v2.28-alpha times - ViewModel version
// IMPORTANT! READ THIS FIRST
// Assisted Injection doesn't work with @HiltViewModel or @ViewModelInject
// Read more about the issue here: https://github.com/google/dagger/issues/2287
//
//
// AssistedInject and Hilt working together in v2.28-alpha times
// Example of a ViewModel using AssistedInject injected in a Fragment by Hilt
// As AssistedInject isn't part of Dagger yet, we cannot use in
// conjuction with @ViewModelInject
@diefferson
diefferson / ResultAsync.kt
Last active November 28, 2018 13:49
Result Patern to Coroutines
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.launch
class ResultAsync<T> private constructor(action: suspend () -> T, scope: CoroutineScope) {
internal var onSuccess : (T) -> Unit = {}
internal var onError : (e: Throwable) -> Unit = {}
companion object {
fun <T> with(action: suspend () -> T, scope: CoroutineScope) :ResultAsync<T>{
#!/usr/bin/env bash
set -euo pipefail
##########
# Config #
##########
readonly GIT_BRANCH='android-8.0.0_r4'
readonly API_LEVEL='26'
@NikolaDespotoski
NikolaDespotoski / ViewModelParameterizedProvider.kt
Last active August 12, 2019 08:11
ViewModelProvider that instantiates ViewModel with parameterized constructor
import android.arch.lifecycle.ViewModel
import android.arch.lifecycle.ViewModelProvider
import android.arch.lifecycle.ViewModelStore
import android.arch.lifecycle.ViewModelStores
import android.support.v4.app.Fragment
import android.support.v4.app.FragmentActivity
import java.util.concurrent.atomic.AtomicBoolean
/**
* Created by Nikola on 7/19/2017.
@nisargjhaveri
nisargjhaveri / CustomFontApplication.java
Created July 13, 2016 12:24
Set fallback fonts globally in android app
package com.example.customfonts;
import android.app.Application;
import android.content.res.AssetManager;
import android.graphics.Typeface;
import android.os.Build;
import java.lang.reflect.Array;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
@cattaka
cattaka / adb-screenshot.sh
Last active December 6, 2017 00:51 — forked from hkurokawa/adb-screenshot.sh
A shell script to take a screen shot of the android device, resize it and copy to clipboard
#! /bin/bash
## This script is for taking a screen shot of an Android device.
## If possible, it tries to resize the image file and then copy to the clipboard.
##
## The script passes unrecognized arguments to adb command, which means you can specify "-e" or "-d"
## to select which device to take a screenshot of.
if [ -z $(which adb) ]; then
echo "Error. adb must be installed and in PATH." 1>&2
@romainpiel
romainpiel / build.gradle
Created March 8, 2016 18:10
Start/stop genymotion devices just to run the tests
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.genymotion:plugin:1.0'
}
}
apply plugin: "genymotion"
@mslinn
mslinn / decompile.bat
Last active March 19, 2024 17:07
Decompile JVM class files using IntelliJ IDEA's embedded FernFlower decompiler
java -cp "C:\Program Files (x86)\JetBrains\IntelliJ IDEA 15.0.2\plugins\java-decompiler\lib\java-decompiler.jar" org.jetbrains.java.decompiler.main.decompiler.ConsoleDecompiler -dgs=true . src
@gregkorossy
gregkorossy / VisionApiFocusFix.java
Last active November 22, 2019 11:38
Mobile Vision API fix for missing autofocus feature
/*
* IF YOU WANT TO JUST ACCESS THE CAMERA INSTANCE SO THAT YOU CAN SET ANY OF THE PARAMETERS, VISIT THE FOLLOWING LINK:
* https://gist.github.com/Gericop/364dd12b105fdc28a0b6
*/
/**
* Custom annotation to allow only valid focus modes.
*/
@StringDef({
Camera.Parameters.FOCUS_MODE_CONTINUOUS_PICTURE,