Skip to content

Instantly share code, notes, and snippets.

View propensive's full-sized avatar

Jon Pretty propensive

View GitHub Profile
@Fristi
Fristi / DiffableDerivation.scala
Created November 28, 2018 07:37
specs2 `Diffable` magnolia derivation
import magnolia.{CaseClass, Magnolia, SealedTrait}
import org.specs2.matcher.describe._
import scala.language.experimental.macros
object DiffableDerivation {
/** binds the Magnolia macro to this derivation object */
implicit def genDiffable[T]: Diffable[T] = macro Magnolia.gen[T]
@jonas
jonas / Typesafe-config-settings.scala
Last active October 13, 2015 10:56
Read Typesafe config settings using approach from http://rapture.io/ 's CLI module
scala> val config = com.typesafe.config.ConfigFactory.parseString("""
| a.b.c = 42
| d.e.f = hello world
| g.h.i = 2m
| """)
config: com.typesafe.config.Config = Config(SimpleConfigObject({"a":{"b":{"c":42}},"d":{"e":{"f":"hello world"}},"g":{"h":{"i":"2m"}}}))
scala> val Alpha = Setting[Int]("a.b.c")
Alpha: commands.common.SimpleSetting[Int] = a.b.c