This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package startup | |
import controllers._ | |
import services._ | |
import akka.actor.ActorSystem | |
import play.api.ApplicationLoader.Context | |
import play.api.libs.ws.ahc._ | |
import play.api.routing.Router | |
import play.api._ | |
import play.api.mvc.EssentialFilter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import shapeless._ | |
import shapeless.labelled._ | |
final case class Employee( | |
name : String, | |
number : Int, | |
manager : Boolean | |
) | |
final case class IceCream( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import shapeless._ | |
// Given this poly: | |
object myPoly extends Poly1 { | |
implicit val intCase: Case.Aux[Int, Double] = | |
at[Int](num => num / 2.0) | |
implicit val stringCase: Case.Aux[String, Int] = | |
at[String](str => str.length) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env amm | |
load.ivy("org.typelevel" %% "cats" % "0.7.0") | |
@ | |
import cats.{Id, ~>} | |
import cats.data.State | |
import cats.free._ | |
import cats.free.Free._ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scala.annotation.tailrec | |
import scala.concurrent.{ ExecutionContext => EC, _ } | |
trait Json // whatever JSON type you're using | |
def getJson(url: String)(implicit ec: EC): Future[Json] = | |
??? // whatever implementation you currently have | |
def getNextUrlFromJson(json: Json): Option[String] = | |
??? // whatever implementation you currently have |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sbt.version=0.13.13-M1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import shapeless._ | |
trait CsvEncoder[A] { | |
def encode(value: A): List[String] | |
} | |
object CsvEncoder { | |
def apply[A](implicit encoder: CsvEncoder[A]): CsvEncoder[A] = | |
encoder |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
find . \( -name \*.jsx\? -or -name \*.coffee -or -name \*.css -or -name \*.less -or -name \*.shtml\? -or -name \*.html\? -or -name \*.php -or -name \*.asp \) -not -path \*.git\* -not -path \*.svn\* -not -path \*compiled\* -not -path \*target\* -exec egrep -H "$1" {} \; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install SBT if you need to: | |
brew install sbt | |
# Make a directory for your project: | |
mkdir MYAPP | |
cd MYAPP | |
# Basic project directory structure: | |
mkdir -p project | |
mkdir -p src/main/scala |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Scala script: run with "scala json.scala" | |
// JSON Library --------------------------------- | |
sealed trait JsValue { | |
def stringify: String = this match { | |
case JsNull => "null" | |
case JsString(value) => "\"" + value + "\"" | |
case JsNumber(value) => value.toString | |
case JsBoolean(value) => value.toString |