This file contains hidden or 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
@Override | |
protected DeploymentContext configureDeployment() { | |
Map<String, String> jespaInit = new HashMap<String, String>(); | |
jespaInit.put("properties.path", "src/test/resources/jespa_ntlm.prp"); | |
ServletContainer servlet = new ServletContainer( | |
new PortfolioApplication()); | |
return ServletDeploymentContext.forServlet(servlet) | |
.initParam("javax.ws.rs.Application", "com._3esi.portfolio.PortfolioApplication") |
This file contains hidden or 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
// (c) Copyright 3ES Innovation Inc. 2013. All rights reserved. | |
package jespa.http; | |
import java.util.Map; | |
import org.slf4j.Logger; | |
import org.slf4j.LoggerFactory; | |
import jespa.security.Account; | |
import jespa.security.Properties; |
This file contains hidden or 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 uk.gov.hmrc.mongo.json | |
/** | |
* Thanks goes to Alexander Jarvis for his Gist (https://gist.github.com/alexanderjarvis/4595298) | |
*/ | |
trait TupleFormats { | |
import play.api.libs.json._ | |
import play.api.data.validation._ | |
implicit def tuple2Reads[B, T1, T2](c : (T1, T2) => B)(implicit aReads: Reads[T1], bReads: Reads[T2]): Reads[B] = Reads[B] { |
This file contains hidden or 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 login = function(credentials) { | |
var deferred = $q.defer(); | |
$http.post(loginEndpoint, credentials).then(function(response) { | |
console.log("Login successful"); | |
localStorage.authToken = response.data; | |
$http.defaults.headers.common.Authorization = 'auth-token ' + localStorage.authToken; | |
$http.get(whoamiEndpoint).then(function(response) { | |
self.user = response.data; | |
deferred.resolve(response.data); | |
}); |
This file contains hidden or 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
freezeApp.controller('UserController', function UserController($scope, userService) { | |
$scope.update = function() { | |
userService.update($scope.user).success(function() { | |
// it worked!! | |
}); | |
}; | |
}); |
This file contains hidden or 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'); | |
}); |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 : {}, |