Skip to content

Instantly share code, notes, and snippets.

Seb Schmidt bastman

Block or report user

Report or block bastman

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@bastman
bastman / generics.kt
Last active Nov 15, 2019
kotlin generics playground
View generics.kt
// https://medium.com/@elye.project/in-and-out-type-variant-of-kotlin-587e4fa2944c
// https://kotlinlang.org/docs/reference/generics.html
// https://www.reddit.com/r/Kotlin/comments/dtfba1/covariance_vs_invariance/
// https://i.imgur.com/oKD9hPL.png
// https://docs.google.com/document/d/13eRz9uu8EuAUagcwEvLDUoWYB7TOyMgJWJyFLJnSB10/
// https://typealias.com/guides/ins-and-outs-of-generic-variance/
data class In<out T:Number>(val c:T)
data class Out<out E>(val c:E)
@bastman
bastman / minutest-testfactory-example.kt
Last active Nov 5, 2019
kotlin-minutest: the missing docs ... how to use @testfactory
View minutest-testfactory-example.kt
// see: https://github.com/dmcg/minutest/blob/master/docs/README.md
// see: https://github.com/dmcg/minutest/blob/master/docs/installation.md
// gradle dependency (jcenter): testImplementation("dev.minutest:minutest:1.9.+")
// how to use?
class FooTests {
@TestFactory
fun `some dynamic tests`() = rootContext {
test(name="a test") {
@bastman
bastman / nullable.kt
Created Oct 31, 2019
kotlin reified T is nullable ?
View nullable.kt
// https://gist.github.com/dant3/1c5f8ba8555cadb0c418523de7857e50
inline fun <reified T> isNullable(): Boolean = null is T
@bastman
bastman / awesome-shell.md
Last active Oct 16, 2019
awesome shell implementations
View awesome-shell.md
@bastman
bastman / FooTest.kt
Last active Oct 15, 2019
jackson-module-kotlin-issue-130
View FooTest.kt
package com.example
import com.fasterxml.jackson.databind.DeserializationFeature
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.databind.SerializationFeature
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
import com.fasterxml.jackson.module.kotlin.readValue
import org.junit.jupiter.api.Test
/**
@bastman
bastman / BlobStorageUri.kt
Created Aug 7, 2019
BlobStorageUri (kotlin, jackson)
View BlobStorageUri.kt
import com.fasterxml.jackson.annotation.JsonCreator
import com.fasterxml.jackson.annotation.JsonValue
data class BlobStorageUri(
val account: String,
val container: String,
val key: String
) {
val uri: String
View psql_sslmode.sh
# https://stackoverflow.com/questions/14021998/using-psql-to-connect-to-postgresql-in-ssl-mode
$ export PGSSLMODE=prefer
$ psql ...
You can’t perform that action at this time.