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 / ballot.sol
Created March 19, 2018 04:43
Code for solidity, a programming language to deploy smart contract to ethereum platform. This demonstrate about case for election that voters can vote and then can show the winning proposal after the election done. Online IDE can be found here: http://remix.ethereum.org/
pragma solidity ^0.4.0;
contract Ballot {
struct Voter {
uint weight;
bool voted;
uint8 vote;
address delegate;
}
struct Proposal {
// implementation 'com.github.ThreeTen:threetenbp:v1.3.6'
// https://github.com/ThreeTen/threetenbp
// similar to java8, but support jdk6 and jdk7
import org.threeten.bp.LocalDateTime;
import org.threeten.bp.format.DateTimeFormatter;
import org.threeten.bp.temporal.ChronoUnit;
public class LocalDateTimeYesterdayChecker {
public static LocalDateTime getYesterday() {
@hendrawd
hendrawd / DeviceInformation.java
Last active June 28, 2023 04:22
Helper class for getting Device Information
package your.app.util;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.ContentResolver;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.res.Configuration;
@hendrawd
hendrawd / ByteUrlGenerator.java
Created August 15, 2018 13:07
An helper method for creating byte url from a string url, then we can copy the result from the console to the actual code
/**
* An helper method for creating byte url from a string url,
* then we can copy the result from the console to the actual code.
* This is useful for fighting against reverse engineering in java/android apps.
* Can be combined with other methods to make your apps more secure.
* Just keep in mind that there is no ways to win against a determined hacker,
* so do all of critical processes in server
*/
public final class ByteUrlGenerator {
@hendrawd
hendrawd / StringPermutation.kt
Created May 10, 2019 14:54
Permutasi String dengan Metode Rekursif Menggunakan Bahasa Pemrograman Kotlin
import java.util.*
fun main(args: Array<String>) {
println("Masukkan Kata/String")
// Mendapatkan kata dari
val word = Scanner(System.`in`).next()
// Membuat list kosong
val indices = mutableListOf<Int>()
class MyFragment private constructor() : Fragment(){
companion object{
private val ARG_CAUGHT = "myFragment_caught"
fun newInstance(caught: Pokemon):MyFragment{
val args: Bundle = Bundle()
args.putSerializable(ARG_CAUGHT, caught)
val fragment = MyFragment()
fragment.arguments = args
return fragment