Skip to content

Instantly share code, notes, and snippets.

View LiewJunTung's full-sized avatar

Liew Jun Tung LiewJunTung

View GitHub Profile
@LiewJunTung
LiewJunTung / gist:333ff2cda9a7149f61cd48e6fcea5491
Created September 9, 2016 18:39
Connect to android wear emulator
adb -d forward tcp:5601 tcp:5601
@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;
}
#include "calculator_impl.hpp"
#include <string>
namespace calculator{
std::shared_ptr<Calculator> Calculator::create() {
return std::make_shared<CalculatorImpl>();
}
CalculatorImpl::CalculatorImpl() {}
#include "calculator_impl.hpp"
#include <iostream>
using namespace std;
using namespace calculator;
int main(int argc, char const *argv[])
{
CalculatorImpl calculator = CalculatorImpl();
int sum = calculator.summation(1, 2);