Skip to content

Instantly share code, notes, and snippets.

View hendrawd's full-sized avatar
☺️
Happy

Hendra Wijaya Djiono hendrawd

☺️
Happy
View GitHub Profile
@hendrawd
hendrawd / TimeUtil.class
Created November 12, 2015 05:50
A Java class with a method that can return relative time span string with Indonesian language(bahasa)
package com;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;
import java.util.concurrent.TimeUnit;
/**
* Created by hendrawd on 11/12/15.
@hendrawd
hendrawd / DuAdHelper.java
Last active June 24, 2016 06:41
An helper class to load interstitial and overwall DU AD
import android.app.Activity;
import android.content.Intent;
import android.util.Log;
import com.duapps.ad.AbsInterstitialListener;
import com.duapps.ad.InterstitialAd;
import com.duapps.ad.offerwall.ui.OfferWallAct;
/**
* @author hendrawd on 6/24/16
@hendrawd
hendrawd / NecrobotMultipleRunner.bat
Last active August 3, 2016 06:36
A runner script to run multiple Necrobot.exe files
@echo off
FOR /D %%s IN (.\*) DO (cd %%s & start Necrobot.exe & cd ..)
exit
@hendrawd
hendrawd / android_studio_shortcuts.md
Created November 22, 2016 09:54 — forked from stkent/android_studio_shortcuts.md
Android Studio Shortcuts (Mac)

Android Studio Shortcuts (Mac)

Notes:

  • Two of the most useful shortcuts utilize the Fn (function) keys. It is therefore recommended that you enable the "Use all F1, F2, etc. keys as standard function keys" option [System Preferences > Keyboard].
  • Be sure to enable the Mac OS X 10.5+ keymap in Android Studio [Preferences > Keymap].
  • A fairly complete shortcut list can be found here.

Useful symbols:

@hendrawd
hendrawd / OkHttp3Stack.java
Last active December 5, 2016 18:47
An OkHttp3Stack for Volley library to boost the performance of Volley itself
import com.android.volley.AuthFailureError;
import com.android.volley.Request;
import com.android.volley.toolbox.HttpStack;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.ProtocolVersion;
import org.apache.http.StatusLine;
import org.apache.http.entity.BasicHttpEntity;
import org.apache.http.message.BasicHeader;
// Copyright (c) ${YEAR}, ${USER}, ITHENA BVBA @ http://www.ithena.be
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
@hendrawd
hendrawd / SpeechToTextActivity.java
Created December 15, 2016 08:45
Simple working test of IBM Watson Speech To Text capability on Android platform
/**
* Copyright (C) 2016 hendrawd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@hendrawd
hendrawd / LocalBroadcastExampleActivity.java
Created September 9, 2017 08:31 — forked from Antarix/LocalBroadcastExampleActivity.java
Simple Example of using LocalBroadcastManager in Android
import android.app.Activity;
import android.app.Service;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.os.IBinder;
import android.support.v4.content.LocalBroadcastManager;
@hendrawd
hendrawd / BukaReksaAnnualPercentageFrom3MonthsCalculator.kt
Created December 27, 2017 05:24
BukaReksaAnnualPercentageFrom3MonthsCalculator.kt
fun main(args: Array<String>) {
println("This program will calculate annual interest of BukaReksa based on 3 months price")
println("Input start price")
val startPrice = readLine()!!.toDouble()
println("Input end price")
val endPrice = readLine()!!.toDouble()
println("Annual interest is ${calculateAnnualInterest(startPrice, endPrice)}")
}
/**
@hendrawd
hendrawd / Singleton.java
Created December 29, 2017 04:14
Example of how to create class and access private constructor of the class using reflection and how to prevent it
/**
* @author hendrawd on 22/12/17
*/
public class Singleton {
// some singleton creation mechanisms
private Singleton(){
// throwing an exception here is needed to avoid developer cheating by creating this class with reflection
throw new UnsupportedOperationException("Should not create instance of Util class. Please use as static..");