Skip to content

Instantly share code, notes, and snippets.

View LiewJunTung's full-sized avatar

Liew Jun Tung LiewJunTung

View GitHub Profile
@LiewJunTung
LiewJunTung / gitshortcut.sh
Last active October 1, 2020 02:21
Useful alias for git
#!/bin/bash
git config --global alias.lg "log --oneline --decorate --all --graph"
git config --global alias.s "status -s"
git config --global pull.rebase true
git config --global rerere.enabled true
git config --global user.name "Liew Jun Tung"
git config --global user.email pandawarrior91@gmail.com
@LiewJunTung
LiewJunTung / gist:333ff2cda9a7149f61cd48e6fcea5491
Created September 9, 2016 18:39
Connect to android wear emulator
adb -d forward tcp:5601 tcp:5601
<!-- Start: Template -->
<template id="vue-datepicker">
<div>
<div class="form-group">
<label for="date-from">From:</label>
<input id="date-from" class="form-control" type="text" v-model="frm" v-on:change="changeFrom">
</div>
<div class="form-group">
<label for="date-to">To:</label>
<input id="date-to" class="form-control" type="text" v-model="to" v-on:change="changeTo">
@LiewJunTung
LiewJunTung / datepicker.js
Created February 9, 2017 06:21 — forked from icai/datepicker.js
vue 2 directive with jqueryui
Vue.directive('datepicker', {
bind: function (el, binding, vnode, oldVnode) {
$(el).datepicker({
onSelect: function (date) {
vnode.context.date = date;
}
});
},
update: function (el, binding, vnode, oldVnode) {
$(el).datepicker('setDate', binding.value);
@LiewJunTung
LiewJunTung / confirmation_email.gs
Created July 29, 2017 05:18
Send Confirmation emails to emails using sendgrid
//This is the main function to run
function initScript() {
var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("IOXKL");
var data = sheet.getDataRange().getValues();
//Your sheets should have the below as headers
var emailIndex = searchHeaderIndex(data, "Email");
var nameIndex = searchHeaderIndex(data, "Name");
var statusIndex = searchHeaderIndex(data, "Status");
@LiewJunTung
LiewJunTung / MainActivity.java
Last active January 27, 2018 14:26
Load C++ in Android Activity
public class MainActivity extends AppCompatActivity {
// Used to load the 'calculator' cpp library on application startup.
static {
System.loadLibrary("calculator");
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@LiewJunTung
LiewJunTung / MainActivity.java
Last active January 27, 2018 14:30
Java Native method
private native String native_say_hello_world();
JNIEXPORT jstring JNICALL Java_com_example_app_MainActivity_native_say_hello_world(JNIEnv* env, jobject thiz ) {
std::string hello = "Hello from C++";
return env->NewStringUTF(hello.c_str());
}
public class MainActivity extends AppCompatActivity {
// Used to load the 'native-lib' library on application startup.
static {
System.loadLibrary("calculator");
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
calculator =
interface +c {
# create() is to create an instance of the calculator
static create(): calculator;
# summation, adding two i32.. aka integers together. And return an integer.
summation(number1: i32, number2: i32):i32;
}