Skip to content

Instantly share code, notes, and snippets.

View RoyGoode's full-sized avatar

Roy Goode RoyGoode

View GitHub Profile
@fabiomsr
fabiomsr / ByteArray.kt
Last active April 24, 2024 08:41
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])
Unless specified otherwise, all of the below tinting applies to both Lollipop and pre-Lollipop using AppCompat v21.
To use the support version of these attributes, remove the android namespace.
For instance, "android:colorControlNormal" becomes "colorControlNormal".
These attributes will be propagated to their corresponding attributes within the android namespace
for devices running Lollipop. Any exceptions to this will be noted by including the "android:" prefix.
All Clickable Views:
-----------
@nicwise
nicwise / gist:1431457
Created December 4, 2011 22:13
threading stuff
using System;
using System.Collections.Generic;
using System.Linq;
using MonoTouch.Foundation;
Task.Factory.StartNew(() => {
Console.WriteLine ("ping");
Thread.Sleep(4000);
Console.WriteLine ("pong");
return "from the thread";