Skip to content

Instantly share code, notes, and snippets.

View talenguyen's full-sized avatar
🎯
Focusing

Nguyen Truong Giang talenguyen

🎯
Focusing
View GitHub Profile
@talenguyen
talenguyen / Debugger.java
Created June 27, 2018 02:09
Print stack trace call for debuging
public static void printStackTrace() {
System.out.println("Printing stack trace:");
StackTraceElement[] elements = Thread.currentThread().getStackTrace();
for (final StackTraceElement element : elements) {
System.out.println("\tat " + element.getClassName() + "." + element.getMethodName()
+ "(" + element.getFileName() + ":" + element.getLineNumber() + ")");
}
}
@talenguyen
talenguyen / keywords.json
Last active August 7, 2018 01:27
Fake keywords for home test @tikivn.
[
"xiaomi",
"bitis hunter",
"bts",
"balo",
"bitis hunter x",
"tai nghe",
"harry potter",
"anker",
"iphone",
@talenguyen
talenguyen / AndroidLog.md
Last active November 22, 2018 04:57
Logging of my Android Development

Multidex Note

Make sure you call MultiDex.install(this); after super.attachBaseContext(base);. Because it will not work in revert order.

@Override
  protected void attachBaseContext(Context base) {
    super.attachBaseContext(base);
    MultiDex.install(this);
  }
@talenguyen
talenguyen / uninstall_3rd_app.sh
Last active October 25, 2018 04:09
Shell script use adb to remove applications on Android Phone
#!/bin/sh
keep_apps=(
com.facebook.mlite
com.zing.zalo
org.telegram.messenger
com.goviet.app
vn.mcdonalds.delivery
com.mcu.iVMS
com.thecoffeehouse.guestapp
com.lastpass.authenticator
@talenguyen
talenguyen / IMMLeaks.java
Created November 7, 2018 07:56
IMMLeaks, leak canary, mHField null.
// Copy from https://gist.github.com/pyricau/4df64341cc978a7de414. Added fixed mHField null.
import static android.content.Context.INPUT_METHOD_SERVICE;
import static android.os.Build.VERSION.SDK_INT;
import static android.os.Build.VERSION_CODES.KITKAT;
import android.app.Activity;
import android.app.Application;
import android.content.Context;
import android.content.ContextWrapper;
@talenguyen
talenguyen / OkHttpClient.kt
Created December 18, 2018 11:09
Make OkHttpClient with cache
val cacheSize = (5 * 1024 * 1024).toLong()
val cache = Cache(context.cacheDir, cacheSize)
// Source https://medium.com/mindorks/caching-with-retrofit-store-responses-offline-71439ed32fda
val okHttpClient = OkHttpClient.Builder()
// Specify the cache we created earlier.
.cache(cache)
// Add an Interceptor to the OkHttpClient.
.addInterceptor { chain ->
@talenguyen
talenguyen / Tiki-app-suggestion-2019.md
Last active December 28, 2018 04:56
Tiki Android Suggestion for 2019

Tiki Android Suggestion for 2019

Framework to support A/B testing.

  • Build features branch.
  • Add more effective tests.

React component proposal

Requirement

  • Props & State
    • Props is properties and is passed to component from outside and immutable.
    • State is similar to props, but it is private and fully controlled by the component.
  • Reactive
    • Props changed -> re-render
  • State chagned -> re-render
@talenguyen
talenguyen / .editorconfig
Last active January 17, 2019 10:25
My .editorconfig for ktlint
[*.{kt,kts}]
# possible values: number (e.g. 2), "unset" (makes ktlint ignore indentation completely)
indent_size=2
# possible values: number (e.g. 2), "unset"
continuation_indent_size=4
# true (recommended) / false
insert_final_newline=true
# possible values: number (e.g. 120) (package name, imports & comments are ignored), "off"
# it's automatically set to 100 on `ktlint --android ...` (per Android Kotlin Style Guide)
max_line_length=100