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 / phantomtypes.kt
Created Dec 12, 2019
kotlin phantom types example - (generics, extensions)
View phantomtypes.kt
// phantom types
// https://proandroiddev.com/phantom-types-in-kotlin-afd3f59fde10
sealed class DoorState
object Open: DoorState()
object Closed: DoorState()
/*
class Door(val state: DoorState) {
@bastman
bastman / awesome-secret-files-encrypt.md
Created Nov 27, 2019
how to encrypt/decrypt secret files ?
View awesome-secret-files-encrypt.md

how to encrypt/decrypt secret files ?

mozilla sops is an editor of encrypted files that supports YAML, JSON, ENV, INI and BINARY formats and encrypts with AWS KMS, GCP KMS, Azure Key Vault and PGP

@bastman
bastman / annotations.kt
Created Nov 21, 2019
spring-kotlin: custom annotations example
View annotations.kt
/**
* Annotations: @RestApiQueryHandler, @RestApiMutationHandler
* as specialization of @Component
* see: @Service for impl.
*
*/
import org.springframework.core.annotation.AliasFor
import org.springframework.stereotype.Component
@kotlin.annotation.Target(AnnotationTarget.CLASS)
@bastman
bastman / generics.kt
Last active Dec 23, 2019
kotlin generics playground
View generics.kt
// The ins and outs of Kotlin: https://kotlin.christmas/2019/22
// 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/
@bastman
bastman / minutest-testfactory-example.kt
Last active Dec 19, 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") {
You can’t perform that action at this time.