Skip to content

Instantly share code, notes, and snippets.

@ChristopherDavenport
ChristopherDavenport / SetOnceCache.scala
Last active October 11, 2021 13:06
Set Once Cache
import cats._
import cats.implicits._
import cats.effect._
import cats.effect.implicits._
import scala.concurrent.duration._
import io.chrisdavenport.mapref._
trait SetOnceCache[F[_], K, V]{
def get(k: K): F[V]
@ChristopherDavenport
ChristopherDavenport / build.sbt
Created June 15, 2020 15:40
Basic Packaging For SBT Projects - Underscores in filenames indicate directories
scalaVersion := "2.13.1"
enablePlugins(JavaAppPackaging)
maintainer := "foo@blah.com"
dockerBaseImage := "java:14"
@bwmcadams
bwmcadams / ADTAnnotationMacro.scala
Last active February 16, 2016 18:19
ADT Root Type validator, makes sure it's either a trait or abstract class *AND* sealed.
package codes.bytes.macros_intro.macros
import scala.annotation.{ compileTimeOnly, StaticAnnotation }
import scala.language.postfixOps
import scala.reflect.macros.whitebox.Context
import scala.language.experimental.macros
object ADT {
def impl(c: Context)(annottees: c.Expr[Any]*): c.Expr[Any] = {
@delagoya
delagoya / test.avdl
Last active July 27, 2023 19:55
Avro IDL comments to Avrodoc example 2
@namespace("com.example")
/**
This is a comment for the whole protocol
*/
protocol Example {
/**
The comment applies to the `NoSpaces` record, but is not indented to the