Skip to content

Instantly share code, notes, and snippets.

View agemooij's full-sized avatar

Age Mooij agemooij

View GitHub Profile
@agemooij
agemooij / customformat.scala
Last active November 28, 2022 13:50
More advanced example of a custom spray-json format
implicit object ProductItemFormat extends RootJsonFormat[ProductItem] {
// some fields are optional so we produce a list of options and
// then flatten it to only write the fields that were Some(..)
def write(item: ProductItem) = JsObject(
List(
Some("product_number" -> item.productNumber.toJson),
item.ean.map(ean ⇒ "ean" -> ean.toJson),
Some("title" -> item.title.toJson),
item.description.map(description ⇒ "description" -> description.toJson),
Some("price" -> item.price.toJson),
@agemooij
agemooij / blue-green.groovy
Created February 21, 2017 09:46 — forked from klingerf/blue-green.groovy
Jenkins pipeline script to perform blue-green deploys to a Kubernetes cluster running linkerd and namerd
node {
def currentVersion = getCurrentVersion()
def newVersion = getNextVersion(currentVersion)
def frontendIp = kubectl("get svc l5d -o jsonpath=\"{.status.loadBalancer.ingress[0].ip}\"").trim()
def originalDst = getDst(getDtab())
stage("clone") {
git url: gitRepo + '.git', branch: gitBranch
}

Keybase proof

I hereby claim:

  • I am agemooij on github.
  • I am agemooij (https://keybase.io/agemooij) on keybase.
  • I have a public key ASDPU5iVgOTv_dmHI-Xf0la16UWZkfd8qxbb_YU3j1zkIAo

To claim this, I am signing this object: