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 org.fusesource.scalate.scuery._ | |
object isitabug { | |
val testinput = | |
<html> | |
<head></head> | |
<body> | |
<div class="test"> | |
<div class="real"> |
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
val Some(r) = routeAndCall(FakeRequest(GET, "/logout"). | |
withSession("username" -> "admin@bigsite")) |
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
trait Security { | |
/** | |
* Retrieve the connected user email. | |
*/ | |
private def username(request: RequestHeader) = | |
request.session.get("username") | |
/** | |
* Redirect to login if the user in not authorized. | |
*/ |
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 test | |
import org.specs2.mutable._ | |
import play.api.test._ | |
import play.api.test.Helpers._ | |
class AuthenticationTests extends Specification { | |
"The authentication system" should { |
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
// This is the part in the Controller that creates the EventSource connection | |
def liveListen(event: String) = Action { request => | |
AsyncResult { | |
implicit val timeout: Timeout = 5.seconds | |
(MegaRoomActor.ref ? (MegaRoomActor.Join(event)) ). | |
mapTo[Enumerator[JsValue]].map(startEventStream) | |
} | |
} |
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 com.rumi | |
object GameOfLife { | |
/** | |
* Calculate the next iteration of the Game of Life. The game state is | |
* represented by a Set[(Int,Int)] of alive cells. A new set is generated | |
* for every generation. Coordinates count from (1,1) to (w,h), while the | |
* (1,1) cell is in the top left corner. | |
* |
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 snmp | |
import ( | |
"net" | |
"os" | |
"syscall" | |
"time" | |
) | |
// PermissiveUDPConn is a UDP connection that allows responses to come from |
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
//JAVA 17 | |
//DEPS org.springframework.boot:spring-boot-dependencies:3.1.3@pom | |
//DEPS org.springframework.boot:spring-boot-starter-web | |
//DEPS org.springframework.boot:spring-boot-starter-data-jdbc | |
//DEPS com.h2database:h2 | |
package app; | |
import org.slf4j.Logger; |