Skip to content

Instantly share code, notes, and snippets.

View jemmyphan's full-sized avatar

Jemmy Phan jemmyphan

  • Springkraf
  • Indonesia
View GitHub Profile
@jemmyphan
jemmyphan / index.js
Created November 9, 2017 18:01
requirebin sketch
axios = require('axios')
var arr = [];
axios.get('http://dev.farizdotid.com/api/daerahindonesia/provinsi/12/kabupaten')
.then((result) => {
result.data.daftar_kecamatan.map((data) => {
axios.get('http://dev.farizdotid.com/api/daerahindonesia/provinsi/kabupaten/' + data.id + '/kecamatan')
.then((res) => {
arr = res.data.daftar_kecamatan.reduce((prev, next) => prev.concat(next.nama), arr)
console.log(JSON.stringify(arr))
@jemmyphan
jemmyphan / index.js
Last active July 18, 2017 09:10
requirebin sketch
// Welcome! require() some modules from npm (like you were using browserify)
// and then hit Run Code to run your code on the right side.
// Modules get downloaded from browserify-cdn and bundled in your browser.
var speakeasy = require("speakeasy");
var action = function() {
var result = document.getElementById('value');
var amount = document.getElementById('amount').value;
var secret = "FuoEvOIGXGNBlMkCp3IAQgoj4eyaNsVH6igi6lD01B5eVmIh7OfOqP6/RI48o4zaXWCyNBzR0S1x6MI1lCYyXg==";
var token = speakeasy.totp({
secret: secret,
/*depedencies: eslint babel-eslint eslint-plugin-babel eslint-plugin-react */
{
"parser": "babel-eslint",
"env": {
"browser": true,
"node": true,
"es6": true
},
"plugins": ["react"],
package com.springkraf.perwira.adapter;
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.springkraf.perwira.R;
import com.springkraf.perwira.api.exception.ApiError;
@jemmyphan
jemmyphan / VerticalItemDecoration.java
Created January 5, 2017 17:07
Item decoration for vertical with color
public class VerticalItemDecoration extends DividerItemDecoration {
public VerticalItemDecoration(Context context, Drawable drawable) {
super(context, DividerItemDecoration.VERTICAL);
this.setDrawable(drawable);
}
public VerticalItemDecoration(Context context, int height, int color) {
this(context, shapeDrawableHelper(context, height, color));
}
@jemmyphan
jemmyphan / CloneHelper.java
Last active December 10, 2016 09:26
Helper for cloning java object (with gson)
public class CloneHelper {
public static <T> T clone(T object) {
return new Clone<T>(object).getClone();
}
private static class Clone<T> {
T object;
private Clone(T object) {