Skip to content

Instantly share code, notes, and snippets.

View HenningCash's full-sized avatar

Henning Kasch HenningCash

View GitHub Profile
@HenningCash
HenningCash / alternate_clicks.js
Created August 16, 2014 13:38
Snap.svg alternate click plugin
/**
* Use like .click() but accepts a second callback
*
* example:
* element.alternateClick(function() {}, function() {});
*/
Snap.plugin(function(Snap, Element) {
Element.prototype.alternateClick = function(first, second) {
var i = 0;
this.click(function() {
@HenningCash
HenningCash / uuid-to-base64.kt
Created July 16, 2019 11:47
Kotlin UUID to Base64 and vice versa
import java.nio.ByteBuffer
import java.nio.charset.Charset
import java.util.*
fun UUID.toBase64(): ByteArray {
val byteArray = ByteBuffer.allocate(16)
.putLong(this.mostSignificantBits)
.putLong(this.leastSignificantBits)
.array()
return Base64.getEncoder().encode(byteArray)