Skip to content

Instantly share code, notes, and snippets.

View andhikayuana's full-sized avatar
🌏
bertapa

Andhika Yuana andhikayuana

🌏
bertapa
View GitHub Profile
@andhikayuana
andhikayuana / Main.java
Created August 1, 2018 08:49
Proxy Pattern
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
public class Main
{
public static void main(String[] args) {
Original original = new Original();
Handler handler = new Handler(original);
@andhikayuana
andhikayuana / Doze_Mode_Behavior.md
Created September 3, 2018 07:02 — forked from christophermark/Doze_Mode_Behavior.md
Android Marshmallow Idle Mode Behavior

What is "idle mode"?

Idle mode is a state where the phone has no network connectivity and apps are temporarily suspended. Idle mode gets triggered by one of two ways: an asleep, still, unplugged phone (Doze mode), and when an app has not been opened in a significant amount of time (App Standby Mode). During idle mode via Doze, the phone will wake up periodically for a short amount of time, allowing apps to run and use network connectivity. Using several different methods outlined below, it is possible to wake apps up during idle mode outside of these maintenance windows.

Time to enter Doze mode

1 hour of being still after the screen turns off.

Time to enter App Standby mode

TBD

Idle maintenance windows

@andhikayuana
andhikayuana / DebouncedOnClickListener.java
Created September 18, 2018 08:21 — forked from rfreedman/DebouncedOnClickListener.java
A debounced onClickListener for Android
import android.os.SystemClock;
import android.view.View;
import java.util.Map;
import java.util.WeakHashMap;
/**
* A Debounced OnClickListener
* Rejects clicks that are too close together in time.
* This class is safe to use as an OnClickListener for multiple views, and will debounce each one separately.
@andhikayuana
andhikayuana / readme.md
Created October 5, 2018 10:41
Install ntfs-3g macos

Install ntfs-3g in macOS

  • Homebrew Required!
  • When enable/disable csrutil you must restart!
$ brew cask install osxfuse
$ brew install ntfs-3g
$ csrutil disable
$ csrutil status
@andhikayuana
andhikayuana / rules.pro
Created October 12, 2018 05:48 — forked from aegis123/rules.pro
ProGuard and DexGuard rules
-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontskipnonpubliclibraryclassmembers
-dontpreverify
-verbose
#your package path where your gson models are stored
-keep class com.project.models.** { *; }
@andhikayuana
andhikayuana / readme.md
Created October 12, 2018 13:14
install tomcat on mojave
@andhikayuana
andhikayuana / sphp.sh
Created November 5, 2018 04:37 — forked from rhukster/sphp.sh
#!/bin/bash
# Creator: Phil Cook
# Email: [email protected]
# Twitter: @p_cook
brew_prefix=$(brew --prefix | sed 's#/#\\\/#g')
brew_array=("5.6","7.0","7.1","7.2")
php_array=("[email protected]" "[email protected]" "[email protected]" "[email protected]")
valet_support_php_version_array=("[email protected]" "[email protected]" "[email protected]" "[email protected]")
php_installed_array=()
Install Ruby Gems on Mac OS X without sudo
1. Add GEM_HOME to your .bash_profile
For example, nano ~/.bash_profile and add
export GEM_HOME=/Users/srinivas/.gem where the path is to your own Home folder
2. Add the gem executables to your system path
Also in .bash_profile, add
@andhikayuana
andhikayuana / RestrictedSocketFactory.java
Created December 17, 2018 06:10 — forked from slightfoot/RestrictedSocketFactory.java
Fix for upload progress monitoring in Android.
import android.util.Log;
import java.io.IOException;
import java.net.InetAddress;
import java.net.Socket;
import java.net.SocketException;
import java.net.UnknownHostException;
import javax.net.SocketFactory;
@andhikayuana
andhikayuana / script1.js
Last active December 27, 2018 08:57
postman collection runner article
pm.globals.get("variable_key"); //untuk mengambil variabel global
pm.variables.get("variable_key"); //mengambil variabel lokal
pm.environment.set("variable_key", "variable_value"); //setting environment variabel
pm.globals.set("variable_key", "variable_value"); //setting variabel global
pm.environment.unset("variable_key"); //hapus environment variabel
pm.globals.unset("variable_key"); //hapus variabel global
// melakukan request ke suatu API
pm.sendRequest("https://postman-echo.com/get", function (err, response) {
console.log(response.json());