Skip to content

Instantly share code, notes, and snippets.

@chriscoomber
chriscoomber / example.kt
Created February 16, 2021 16:23
Kotlin sealed class with order
sealed class GoodCountries(val order: Int) {
class Brazil : GoodCountries(0)
class USA : GoodCountries(1)
class Germany : GoodCountries(2)
class China : GoodCountries(3)
}
@chriscoomber
chriscoomber / SingletonBase.kt
Last active February 22, 2021 07:04
Singletons with constructors in Kotlin
package com.example.app.utils
import org.jetbrains.annotations.TestOnly
/**
* Generic singleton implementation.
*
* # Usage
*
* First, defining your singleton:
@chriscoomber
chriscoomber / Cargo.toml
Last active April 9, 2017 20:25
Tokio core + MPSC channel example
[package]
name = "example"
version = "0.1.0"
authors = ["chriscoomber <christopher.coomber@metaswitch.com>"]
[dependencies]
futures = "*"
tokio-core = "*"