Skip to content

Instantly share code, notes, and snippets.

View joshdaquino's full-sized avatar

Joshua joshdaquino

  • Philippines
View GitHub Profile
0x1DB7522111E53760F2779729c76f65552A125c23
0xea530b949A5d72c803e3620B9Da1AfaC016616F3
@joshdaquino
joshdaquino / ByteArray.kt
Created April 19, 2017 09:25 — forked from fabiomsr/ByteArray.kt
ByteArray and String extension to add hexadecimal methods in Kotlin
private val HEX_CHARS = "0123456789ABCDEF".toCharArray()
fun ByteArray.toHex() : String{
val result = StringBuffer()
forEach {
val octet = it.toInt()
val firstIndex = (octet and 0xF0).ushr(4)
val secondIndex = octet and 0x0F
result.append(HEX_CHARS[firstIndex])
@joshdaquino
joshdaquino / gist:4e1136d5d77767f66cea39aa37265aa0
Created February 20, 2017 09:07 — forked from dodyg/gist:5616605
Kotlin Programming Language Cheat Sheet Part 2

This is a quick guide to Kotlin programming language. The previous part of this guide is here

#Object Oriented

fun main(args : Array<String>) {
  class local (val x : Int)
  
  val y = local(10)
 println("${y.x}")
@joshdaquino
joshdaquino / gist:bcb08463f3e676f44f9c866dac307c0d
Created February 20, 2017 09:05 — forked from dodyg/gist:5823184
Kotlin Programming Language Cheat Sheet Part 1

#Intro

Kotlin is a new programming language for the JVM. It produces Java bytecode, supports Android and generates JavaScript. The latest version of the language is Kotlin M5.3

Kotlin project website is at kotlin.jetbrains.org.

All the codes here can be copied and run on Kotlin online editor.

Let's get started.