Skip to content

Instantly share code, notes, and snippets.

@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") {
@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