This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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 { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.4.0; | |
contract Ballot { | |
struct Voter { | |
uint weight; | |
bool voted; | |
uint8 vote; | |
address delegate; | |
} | |
struct Proposal { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.4.0; | |
/* | |
Currency that can only be issued by its creator and transferred to anyone | |
*/ | |
contract DragonStone { | |
address public creator; | |
mapping (address => uint) public balances; | |
// event that notifies when a transfer has completed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.4.0; | |
/* | |
Simple contract that returns a greeting | |
*/ | |
contract Hodor { | |
address creator; | |
string greeting; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.PrintWriter | |
import java.math.BigInteger | |
/** | |
* ${Website} | |
* Created on ${DAY} ${MONTH_NAME_FULL} ${YEAR} | |
* @author ${USER} | |
*/ | |
fun main(args: Array<String>) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @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.."); |
NewerOlder