Skip to content

Instantly share code, notes, and snippets.

View quangson91's full-sized avatar
🎯
Focusing

QuangSon quangson91

🎯
Focusing
  • Freedom
  • Earth
View GitHub Profile
@quangson91
quangson91 / solution.md
Created February 3, 2021 08:51 — forked from lgg/solution.md
JetBrains intellij idea + NVM + nodejs + WebStorm

NVM + WebStorm

If you get error:

run npm command gives error "/usr/bin/env: node: No such file or directory

in file watcher

@quangson91
quangson91 / export-to-csv.gs
Created April 4, 2019 02:20 — forked from mderazon/export-to-csv.gs
Google apps script to export to individual csv files all sheets in an open spreadsheet
/*
* script to export data in all sheets in the current spreadsheet as individual csv files
* files will be named according to the name of the sheet
* author: Michael Derazon
*/
function onOpen() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var csvMenuEntries = [{name: "export as csv files", functionName: "saveAsCSV"}];
ss.addMenu("csv", csvMenuEntries);
api=28
branch=android-9.0.0_r3
mkdir android-sdk-source-build
cd android-sdk-source-build
mkdir -p frameworks/base
# Fetch repositories that contain the sources we're interested in
git clone --depth 1 https://android.googlesource.com/platform/frameworks/base -b $branch frameworks/base
@quangson91
quangson91 / pr.md
Created June 6, 2018 01:40 — forked from piscisaureus/pr.md
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawerLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:id="@+id/content_frame"
@quangson91
quangson91 / ExampleApplication.java
Created January 3, 2018 03:55 — forked from pepyakin/ExampleApplication.java
Gist which should prevent leaks of Activity in ClipboardUIManager.
public class ExampleApplication extends Application {
@Override public void onCreate() {
super.onCreate();
try {
Class<?> cls = Class.forName("android.sec.clipboard.ClipboardUIManager");
Method m = cls.getDeclaredMethod("getInstance", Context.class);
Object o = m.invoke(null, this);
} catch (Exception ignored) { }
}
}
@quangson91
quangson91 / android_screenshot.sh
Created December 2, 2017 02:47
Screenshot for android by commandline
PREFIX="android_screenshot"
if [ $# -gt 0 ]
then
PREFIX=$1
fi
adb shell screencap -p | perl -pe 's/\x0D\x0A/\x0A/g' > ~/Downloads/${PREFIX}_$(date +'%Y-%m-%d_%H-%M-%S').png
@quangson91
quangson91 / update_java_home.sh
Created November 27, 2017 02:38
Update JAVA_HOME with jvm
update_java_home() {
local java_version=`jenv version-name`
export JAVA_HOME="`/usr/libexec/java_home -v $java_version`"
}
update_java_home
@quangson91
quangson91 / BaseAdapter.java
Created November 12, 2017 08:12
Custom multi view types for RecycleView
@SuppressWarnings("unchecked")
public class BaseAdapter extends RecyclerView.Adapter<BaseAdapter.ViewHolder> {
private final List<Wrapper<?>> items;
public BaseAdapter() {
this.items = new ArrayList<>();
}
@Override
public int getItemViewType(int position) {
1. Setup a project
2. Add groovy SDK support:
https://www.bonusbits.com/wiki/HowTo:Add_Groovy_SDK_to_IntelliJ_IDEA
3. Download http://(yourjenkinsurl)/job/(yourpipelinejob)/pipeline-syntax/gdsl
- this will give you the .gdsl file - download this to the src folder of your project.
4. Finally follow this step - right click on the src folder -> Mark directory as -> Sources Root