Skip to content

Instantly share code, notes, and snippets.

View truongngoclinh's full-sized avatar
🎯
Focusing

Trương Ngọc Linh truongngoclinh

🎯
Focusing
  • Tokyo
View GitHub Profile
@truongngoclinh
truongngoclinh / learning_react_native.md
Created April 2, 2017 08:01 — forked from sibelius/learning.md
Learning Path React Native

Basics

  • Learn how to start a new react native project
  • Run it on ios simulator, on android emulator, on a real iPhone device and on a real Android device, with and without debugging enabled.
  • Learn how to upgrade a react native project
  • Learn how to add a package to the project
  • Learn how to add a package that has a native dependency (https://github.com/airbnb/react-native-maps, https://github.com/evollu/react-native-fcm) - DO NOT USE COCOAPODS
  • Learn how to use fetch to get data from your backend

Learn Navigation

@truongngoclinh
truongngoclinh / GsonDecodeListObject.java
Last active April 7, 2017 05:09
Passing list object through intent with gson.toJson and gson.fromJson
// passing to intent:
b.putSerializable(BUNDLE_PARAMS, new Gson().toJson(params));
// retrieving data:
List<KeyValueStringPair> params = new Gson().fromJson(b.getString(BUNDLE_PARAMS), new TypeToken<List<KeyValueStringPair>>(){}.getType())
// model class
public static class KeyValueStringPair implements Serializable {
@SerializedName("_key")
# Built application files
*.apk
*.ap_
# Files for the ART/Dalvik VM
*.dex
# Java class files
*.class
@truongngoclinh
truongngoclinh / addSpacesBetweenChars.java
Created April 21, 2017 06:55
add space between chars
// add double spaces
public String addSpacesBetweenChar(String str) {
if (!str.contains("*")) {
str = "******" + str;
}
return str.replaceAll(".(?=.)", "$0 ");
}
@truongngoclinh
truongngoclinh / git_submodules.md
Created April 26, 2017 13:15 — forked from gitaarik/git_submodules.md
Git Submodules basic explanation

Git Submodules basic explanation

Why submodules?

In Git you can add a submodule to a repository. This is basically a repository embedded in your main repository. This can be very useful. A couple of advantages of using submodules:

  • You can separate the code into different repositories.
final LinearLayout layout = (LinearLayout) findViewById(R.id.YOUR_VIEW_ID);
ViewTreeObserver vto = layout.getViewTreeObserver();
vto.addOnGlobalLayoutListener (new OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
layout.getViewTreeObserver().removeOnGlobalLayoutListener(this);
int width = layout.getMeasuredWidth();
int height = layout.getMeasuredHeight();
}
public class MyProgressDialog extends ProgressDialog {
private TextView mTvMessage;
private Context mContext;
public VedProgressDialog(Context context) {
super(context);
mContext = context;
setIndeterminate(true);
setCancelable(false);
@truongngoclinh
truongngoclinh / Filter32.java
Created May 5, 2017 09:15
React native issue with loading 64 bit .so libs
// https://corbt.com/posts/2015/09/18/mixing-32-and-64bit-dependencies-in-android.html
android {
...
defaultConfig {
...
ndk {
abiFilters "armeabi-v7a", "x86"
}
@truongngoclinh
truongngoclinh / Android Privacy Policy Template
Created June 8, 2017 10:54 — forked from alphamu/Android Privacy Policy Template
A template for creating your own privacy policy for Android apps. Look for "[" and "<!--" to see where you need to edit this app in order to create your own privacy olicy.
<html>
<body>
<h2>Privacy Policy</h2>
<p>[Individual or Company Name] built the [App Name] app as a [open source | free | freemium | ad-supported | commercial] app. This SERVICE is provided by [Individual or company name] [at no cost] and is intended
for use as is.</p>
<p>This page is used to inform website visitors regarding [my|our] policies with the collection, use, and
disclosure of Personal Information if anyone decided to use [my|our] Service.</p>
<p>If you choose to use [my|our] Service, then you agree to the collection and use of information in
relation with this policy. The Personal Information that [I|we] collect are used for providing and
improving the Service. [I|We] will not use or share your information with anyone except as described
<html>
<body>
<h2>Privacy Policy</h2>
<p>[Individual or Company Name] built the [App Name] app as a [open source | free | freemium | ad-supported | commercial] app. This SERVICE is provided by [Individual or company name] [at no cost] and is intended
for use as is.</p>
<p>This page is used to inform website visitors regarding [my|our] policies with the collection, use, and
disclosure of Personal Information if anyone decided to use [my|our] Service.</p>
<p>If you choose to use [my|our] Service, then you agree to the collection and use of information in
relation with this policy. The Personal Information that [I|we] collect are used for providing and
improving the Service. [I|We] will not use or share your information with anyone except as described