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
data class Informer<T : Resource>(val blah : Int = 1) { | |
private var started = false | |
fun start(): Boolean { | |
if (!started) { | |
this.started = true | |
return true | |
} else { | |
return false |
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
interface Transport{ | |
fun <T : Resource> get(kind: Kind, name: String): T? | |
fun <T : Resource> list(kind: Kind): List<T> | |
} | |
class HTTPTransport : Transport { | |
override fun <T : Resource> get(kind: Kind, name: String): T? { | |
return null | |
} |
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
fun main(args: Array<String>) { | |
println("Foldwhile experiment") | |
val oneTo100 = 1 until 100 | |
println(oneTo100.fold(0) { acc, v -> acc + v}) | |
println("Stop folding when total is above 2000") | |
println(oneTo100.foldWhile(0, { acc, v -> acc + v }, { acc, _ -> acc < 2000 })) |
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 K8SInformer { | |
constructor() { | |
this.listeners = []; | |
this.queue = []; | |
} | |
addListener(listener) { | |
this.listeners.push(listener); | |
} |
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
Hello, | |
In recent weeks, many of our customers have noticed instability, degraded performance, and increased rendering errors from imgix due to a series of ongoing issues. This by itself is unacceptable, and we have been working tirelessly to address it. | |
However, in the struggle to fix things, we have also failed in our duty to communicate with our customers. I have received complaints that imgix has not been transparent enough about the scope of the issues and when they will be resolved. As CEO, I take full responsibility for this. That is not the kind of company I want imgix to be. You deserve to know when there are issues that could negatively affect you. You deserve to know what we are doing to make it right. | |
In the spirit of transparency, I have published a blog post about the recent challenges. In this post, I document exactly what is happening, explain why it is happening, and lay out what we are doing to fix it so that it does not happen again. I invite you to read the post, and to contact me or you |
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 io.kotlintest.specs.StringSpec | |
import kotlinx.coroutines.* | |
import kotlin.coroutines.CoroutineContext | |
class RequestContextTest : StringSpec({ | |
"playing with human context" { | |
try { | |
runBlocking { |
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 io.kotlintest.specs.StringSpec | |
import kotlinx.coroutines.* | |
import kotlin.coroutines.CoroutineContext | |
class RequestContextTest : StringSpec({ | |
"playing with human context" { | |
try { | |
runBlocking { |
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
sealed class MapDiffResult<T : Any,V : Any> { | |
data class Added<T : Any,V : Any>(val key : T, val v : V) : MapDiffResult<T, V>() | |
data class Removed<T : Any,V : Any>(val key : T, val oldValue : V) : MapDiffResult<T, V>() | |
data class Changed<T : Any,V : Any>(val key : T, val new : V, val old :V) : MapDiffResult<T, V>() | |
} | |
fun <K : Any,V : Any> Map<K,V>.diffMaps(to: Map<K,V>, isSame : (V, V?) -> Boolean = { v,v2 -> v == v2 }) : List<MapDiffResult<K, V>> { | |
val from = this |
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 DType<A> { | |
readonly _A!: { [P in keyof A] : A[P] } | |
constructor(t : A) { | |
} | |
} | |
const UserModel = new DType({ name: ""}) | |
type Infer<C extends any> = C['_A'] |
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
interface TypeRep<T> { | |
_UnderlyingType: T | |
} | |
class ValidatedType<T extends { [TKey in keyof T] : TypeRep<unknown> }> { | |
readonly _T!: { [TKey in keyof T] : T[TKey]['_UnderlyingType'] } | |
constructor(t : T) { } | |
} |