Skip to content

Instantly share code, notes, and snippets.

@mikesname
mikesname / gist:5237809
Last active December 15, 2021 23:10
Example Play JSON Enum reading/writing
package enumtest
import play.api.libs.json._
object EnumUtils {
def enumReads[E <: Enumeration](enum: E): Reads[E#Value] = new Reads[E#Value] {
def reads(json: JsValue): JsResult[E#Value] = json match {
case JsString(s) => {
@hmrclt
hmrclt / Prereg.scala
Created January 9, 2018 16:04
SDIL-prereg
object prereg {
def OptList[A](in: List[A]): List[Option[A]] =
None :: in.toList.map(Some(_))
object GG extends Enumeration { val CT, SA, SDIL = Value }
object Affinity extends Enumeration {
val Agent, Individual, Org_Admin, Org_Assistant, Other = Value
}
grep -rl matchstring somedir/ | xargs sed -i 's/string1/string2/g'