Instantly share code, notes, and snippets.

View AutomateScalafmtPlugin.scala
// Works for scalafmt 0.5.5
import org.scalafmt.bootstrap.ScalafmtBootstrap
import org.scalafmt.sbt.ScalafmtPlugin
import sbt._
import sbt.Keys._
import sbt.inc.Analysis
object AutomateScalafmtPlugin extends AutoPlugin {
View Scripts_for_Gabbler.md

Scripts for Gabbler

  • run-cassandra and wait until up
  • run-etcd
  • run-gabbler-user
  • run-gabbler-chat
View actor.scala
import akka.actor.{ Actor, Props }
object $NAME$ {
def props: Props = Props(new $NAME$)
}
class $NAME$ extends Actor {
override def receive = ???
}
View TestProbeOps.scala
implicit class TestProbeOps(probe: TestProbe) {
/**
* Assert that an actor exists under the given path by trying to identify the actor repeatedly until the timeout
* – either given explicitly or taken from the innermost enclosing `within` block – expires.
* @param path the path of the actor which existence is to be asserted
* @param identifyTimeout the maximum duration for trying to identify the actor once – 100 milliseconds per default
* @return The `ActorRef` of the identified actor
* @throws AssertionError if the actor can't be identified
*/
View FRESH-SIMPLE.MD

fresh-simple

fresh_simple is a script to scaffold a fresh simple single-module sbt project: It creates an sbt build according to established best practices, creates a useful package object for the root package, initializes a Git repository and creates an initial commit, etc.

Installation

mkdir -p ~/bin
curl -o ~/bin/fresh-simple -H "Cache-Control: no-cache" https://gist.githubusercontent.com/hseeberger/bff7eab8f155d4bc742c/raw/fresh-simple-invoker
chmod u+x ~/bin/fresh-simple
View gist:9db8b6501ef8e0d9b6e8
import scala.annotation.tailrec
val s0 = "rats live on arona no evil star"
val az = 'a'.to('z')
val counterpart = az.zip(az.reverse).toMap
val s1 = s0.split(" ").toList.map(_.map(counterpart))
val value = (' ' +: az).zipWithIndex.tail.toMap
val s2 = s1.map(_.map(value))
View keybase.md

Keybase proof

I hereby claim:

  • I am hseeberger on github.
  • I am hseeberger (https://keybase.io/hseeberger) on keybase.
  • I have a public key whose fingerprint is 999D 6A93 3115 459F 0C00 2937 AD23 BE8B D24F B231

To claim this, I am signing this object:

View FRESH.md

fresh

fresh is a script to scaffold a fresh single-module sbt project: It creates an sbt build according to established best practices, creates a useful package object for the root package, initializes a Git repository and creates an initial commit, etc.

Installation

mkdir -p ~/bin
curl -o ~/bin/fresh -H "Cache-Control: no-cache" https://gist.githubusercontent.com/hseeberger/11048475/raw/fresh-invoker
chmod u+x ~/bin/fresh