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 euler | |
import scala.actors.Actor | |
import Actor._ | |
object Euler011 extends Actor { | |
type Matrix = Seq[Seq[Int]] | |
case class CalculateMaxRequest(matrix: Matrix, from: Actor) | |
case class CalculateMaxReply(matrix: Matrix, max: Int) |
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 models | |
case class ProductionType( | |
key: String, | |
name: String, | |
blended: Boolean, | |
forecast: Boolean, | |
actual: Boolean, | |
field: Boolean, | |
financial: Boolean, |
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
def dashboard = Action { | |
val user = User.findByUsername("aczerwonka") | |
val prefs = UserPreferences.findByUsername("aczerwonka") | |
val config = Configuration.get(); | |
Ok(views.html.dashboard(user, prefs, config)) | |
} |
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
def measures(user: User): List[Measure] = { | |
val prefs = UserPreferences.findByUser(user) // get my prefs | |
val request = generateRequest(prefs) // build up a WS request | |
val promise = WS.url(exportEndpoint).post(request) | |
promise.orTimeout(Nil, 100000).map { responseOrTimeout => | |
responseOrTimeout.fold( | |
response => { | |
val body = promise.value.get.body | |
val lines = body.split("\n").map(_.split(",")) | |
lines.map { |
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 play.api._ | |
import play.api.mvc._ | |
import play.api.libs.ws.WS | |
import play.api.libs.concurrent.Execution.Implicits._ | |
import java.io.File | |
object Application extends Controller { | |
def index(email: String) = Action { | |
Async { |
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
service.factory('userService', [ | |
'$http', | |
function($http) { | |
return { | |
name : 'User Service', | |
request : {}, | |
successF : {}, | |
errorF : {}, |
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 akka.actor.{Actor, Stash} | |
class PausableWorker extends Actor with Stash { | |
def receive = processing | |
def processing: Receive = { | |
case "pause" => context.become(paused) | |
case msg => // Process task | |
} | |
def paused: Receive = { |
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
[merge] | |
summary = true | |
tool = "p4" | |
[mergetool "p4"] | |
cmd = /Applications/p4merge.app/Contents/Resources/launchp4merge \ | |
"$PWD/$BASE" \ | |
"$PWD/$LOCAL" \ | |
"$PWD/$REMOTE" \ | |
"$PWD/$MERGED" |
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
case class CreateParams(name: String, interval: Int, camera: Boolean, sensors: IndexedSeq[Sensor]) | |
implicit val createParamsReads = new Reads[CreateParams] { | |
def reads(js: JsValue): JsResult[CreateParams] = { | |
val name = (js \ "name").as[String] | |
val interval = (js \ "interval").as[Int] | |
val camera = (js \ "camera").as[Boolean] | |
val sensors = (js \ "sensors").as[IndexedSeq[Sensor]] | |
JsSuccess(CreateParams(name, interval, camera, sensors)) | |
} | |
} |
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
var authToken = localStorageService.get('authToken'); | |
$http.defaults.headers.common.Authorization = 'auth-token ' + authToken; | |
$http.get('/api/whoami').success(function(data) { | |
self.user = data; | |
}).error(function() { | |
self.user = null; | |
$location.path('/login'); | |
}); |
OlderNewer