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 / work-with-multiple-github-accounts.md
Created June 5, 2023 12:14 — forked from rahularity/work-with-multiple-github-accounts.md
How To Work With Multiple Github Accounts on your PC

How To Work With Multiple Github Accounts on a single Machine

Let suppose I have two github accounts, https://github.com/rahul-office and https://github.com/rahul-personal. Now i want to setup my mac to easily talk to both the github accounts.

NOTE: This logic can be extended to more than two accounts also. :)

The setup can be done in 5 easy steps:

Steps:

  • Step 1 : Create SSH keys for all accounts
  • Step 2 : Add SSH keys to SSH Agent
@truongngoclinh
truongngoclinh / Activity.java
Last active November 7, 2022 06:53
Handle permission on Android 6.0 and above versions.
public class Activity extends AppCompatActivity {
private static final String TAG = "FVPermissionsActivity";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
if (FVPermissionUtils.isPermissionGranted(this, FVPermissionUtils.Permissions.OVERLAY)) {
apply plugin: 'com.android.application'
apply plugin: 'android-apt'
android {
compileSdkVersion versions.compileSdk
buildToolsVersion versions.buildTools
defaultConfig {
applicationId "samples.linhtruong.com.ui_reactive_rxjava_realm"
minSdkVersion versions.minSdk
@truongngoclinh
truongngoclinh / GitlabGroupCloning.sh
Created July 24, 2019 12:32
Clone all projects in gitlab group
#!/usr/bin/env bash
BASE_PATH="your domain"
GITLAB_PRIVATE_TOKEN="your private token"
if [ -z "$1" ]
then
echo "group name is required."
exit 1;
@truongngoclinh
truongngoclinh / jacoco_app_kotlin.gradle
Last active April 20, 2021 11:19
Jacoco test coverage report for package, application level
apply plugin: 'jacoco'
android {
testOptions.unitTests.all {
jacoco {
includeNoLocationClasses = true
}
}
}
Hex Opacity Values
100% — FF
95% — F2
90% — E6
85% — D9
80% — CC
75% — BF
70% — B3
65% — A6
private Bitmap generateReceiptBitmap(ArrayList<PrinterDatum> data) {
ReceiptViewAdapter adapter = new ReceiptViewAdapter();
RecyclerView rv = new RecyclerView(mActivity);
rv.setLayoutManager(new LinearLayoutManager(mActivity, LinearLayoutManager.VERTICAL, false));
rv.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT));
rv.setAdapter(adapter);
adapter.setData(data);
return loadBitmapFromView(rv);
}
@truongngoclinh
truongngoclinh / TSLInt-Prettier-CreateReactApp-TypeScript-setup.md
Created May 3, 2019 05:29 — forked from rimatla/TSLInt-Prettier-CreateReactApp-TypeScript-setup.md
Create React App + TypeScript Linting with TSLint and Prettier setup for on VSCode

Ps: The current setup was done on 01-04-19

Project Dependency Versions at the time 👇

  "react": "^16.7.0",
  "react-dom": "^16.7.0",
  "react-scripts": "2.1.3",
  "typescript": "^3.2.2"
  "tslint": "^5.12.0",
  "tslint-config-prettier": "^1.17.0",
private fun <T> any(): T {
Mockito.any<T>()
return uninitialized()
}
private fun <T> uninitialized(): T = null as T
private fun <T> any(): T {
Mockito.any<T>()
return uninitialized()
}
private fun <T> uninitialized(): T = null as T