Skip to content

Instantly share code, notes, and snippets.

View lenguyenthanh's full-sized avatar
👻

Thanh Le lenguyenthanh

👻
View GitHub Profile
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.Type;
@lenguyenthanh
lenguyenthanh / EditTextUtil
Created January 16, 2015 04:36
Util file to hide keyboard with current EditText
import android.annotation.SuppressLint;
import android.content.Context;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.os.ResultReceiver;
import android.os.SystemClock;
import android.view.MotionEvent;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
@lenguyenthanh
lenguyenthanh / gradle.properties
Last active August 29, 2015 14:18
gradle.properties
ANDROID_BUILD_MIN_SDK_VERSION=14
ANDROID_BUILD_TARGET_SDK_VERSION=21
ANDROID_BUILD_TOOLS_VERSION=21.1.1
ANDROID_BUILD_SDK_VERSION=21
org.gradle.daemon=true
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
org.gradle.parallel=true
org.gradle.configureondemand=true
@lenguyenthanh
lenguyenthanh / RootUtils.java
Created October 28, 2015 07:43
RootUtils class
public class RootUtil {
public static boolean isDeviceRooted() {
return checkRootMethod1() || checkRootMethod2() || checkRootMethod3();
}
private static boolean checkRootMethod1() {
String buildTags = android.os.Build.TAGS;
return buildTags != null && buildTags.contains("test-keys");
}
@lenguyenthanh
lenguyenthanh / Dagger 2.md
Last active May 7, 2020 19:55
Dagger 2 configuration

Small gist shows how to config Dagger 2 to an Android project

Alt + F12: Editor, terminal toggle
Cmd + Shift + L: Enable/Disable Vim plugin
Cmd + Shift + W: Show/hide Tool buttons
Cmd + Shift + S: Show/hide Toolbar
Cmd + Shift + X: Show/hide Android Build Variants
Cmd + Ctrl + P: Split editors vertically
@lenguyenthanh
lenguyenthanh / delete_git_submodule.md
Created December 1, 2018 17:29 — forked from myusuf3/delete_git_submodule.md
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
@lenguyenthanh
lenguyenthanh / instructions.md
Created April 10, 2019 17:12 — forked from douglasmiranda/instructions.md
Add email to Keybase.io PGP Key (Public Key)

Export your public key:

keybase pgp export > keybase-public.key

Export your private key:

keybase pgp export --secret > keybase-private.key
@lenguyenthanh
lenguyenthanh / fx-test.kt
Created July 5, 2019 07:09 — forked from colomboe/fx-test.kt
Porting of "Simple example of testing with ZIO environment" to Kotlin
// Porting of https://gist.github.com/jdegoes/dd66656382247dc5b7228fb0f2cb97c8
typealias UserID = String
data class UserProfile(val name: String)
// The database module:
interface DatabaseService {
suspend fun dbLookup(id: UserID): UserProfile
suspend fun dbUpdate(id: UserID, profile: UserProfile)
}