Skip to content

Instantly share code, notes, and snippets.

View vidbina's full-sized avatar
😪
M-x parental-mode

David Asabina vidbina

😪
M-x parental-mode
View GitHub Profile
@guillaumebort
guillaumebort / Secured.scala
Created April 7, 2012 12:05
HTTP Basic Authorization for Play 2.0
def Secured[A](username: String, password: String)(action: Action[A]) = Action(action.parser) { request =>
request.headers.get("Authorization").flatMap { authorization =>
authorization.split(" ").drop(1).headOption.filter { encoded =>
new String(org.apache.commons.codec.binary.Base64.decodeBase64(encoded.getBytes)).split(":").toList match {
case u :: p :: Nil if u == username && password == p => true
case _ => false
}
}.map(_ => action(request))
}.getOrElse {
Unauthorized.withHeaders("WWW-Authenticate" -> """Basic realm="Secured"""")
@nguillaumin
nguillaumin / docker-rouge.md
Last active August 10, 2018 11:47
Using Docker for Rouge development

Using Docker for Rouge development

Docker can be used to avoid having to install Ruby and all the dependencies locally.

Clone the project first, and navigate into your clone:

$ git clone https://github.com/jneen/rouge.git
$ cd rouge
@grahamc
grahamc / nixos-on-dell-9560.org
Last active December 1, 2017 22:02
NixOS on a Dell 15" 9560 with the 4K screen.