Skip to content

Instantly share code, notes, and snippets.

View yakamoto69's full-sized avatar

Kenji Iino yakamoto69

  • Tokyo, Japan
View GitHub Profile
@rethab
rethab / named-instance.scala
Created September 12, 2016 09:49
get instance by named annotation from guice injector with the play framework
import play.api.inject.{QualifierInstance, BindingKey}
import com.google.inject.name.Names
val injector = ???
injector.instanceOf(BindingKey(classOf[MyType], Some(QualifierInstance(Names.named("my-thing")))))
@solidsnack
solidsnack / basicauth.scala
Created January 5, 2014 19:17
Basic Auth helper for Play Framework
// Call in the scope of a request handler to retrieve basic auth parameters
// if they are present.
def basicAuth()(implicit request: Request[_]): Option[(String, String)] = {
val Basic = "^ *Basic +([^ ].+)$".r
for {
auth <- request.headers.get("Authorization")
Basic(base64) <- Basic.findFirstIn(auth)
decoded <- Option(new BASE64Decoder().decodeBuffer(base64))
plain <- Option(new String(decoded, "UTF-8"))
@kmizu
kmizu / gist:1876800
Last active December 22, 2019 00:05 — forked from gakuzzzz/gist:1865400
Scala環境構築

Scala 開発環境構築手順

前提条件

  • JDKがinstall済みであること
  • java コマンドに環境変数Pathが通っていること