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 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
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
// (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
@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
2015-11-14 03:21:58 -0500 [ERROR] from play.core.server.netty.PlayDefaultUpstreamHandler in New I/O worker #4 - Exception caught in Netty | |
java.lang.IllegalArgumentException: invalid version format: ?+??H???9 ? | |
at org.jboss.netty.handler.codec.http.HttpVersion.<init>(HttpVersion.java:94) ~[io.netty.netty-3.10.4.Final.jar:na] | |
at org.jboss.netty.handler.codec.http.HttpVersion.valueOf(HttpVersion.java:62) ~[io.netty.netty-3.10.4.Final.jar:na] | |
at org.jboss.netty.handler.codec.http.HttpRequestDecoder.createMessage(HttpRequestDecoder.java:75) ~[io.netty.netty-3.10.4.Final.jar:na] | |
at org.jboss.netty.handler.codec.http.HttpMessageDecoder.decode(HttpMessageDecoder.java:191) ~[io.netty.netty-3.10.4.Final.jar:na] | |
at org.jboss.netty.handler.codec.http.HttpMessageDecoder.decode(HttpMessageDecoder.java:102) ~[io.netty.netty-3.10.4.Final.jar:na] | |
at org.jboss.netty.handler.codec.replay.ReplayingDecoder.callDecode(ReplayingDecoder.java:500) ~[io.netty.netty-3.10.4.Final.jar:na] | |
at org.jboss.netty.handler.codec.replay.Re |
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
# to generate your dhparam.pem file, run in the terminal | |
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048 |
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._ | |
import javax.inject._ | |
import database.MongoEnvironment | |
import play.api.inject.ApplicationLifecycle | |
import play.api._ | |
import scala.concurrent.ExecutionContext | |
@Singleton |
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
[Fact] | |
public void DepreciationCalculation_NoDepreciationEntries() | |
{ | |
_test | |
.MonthlyWindow("2016-01-01", 12) | |
.DecliningBalance(depreciationRate: 0.0) | |
.CapexEntry("2016-01-01", 100) | |
.Expect( | |
"2016-01-01 0", | |
"2016-01-02 0", |
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
object ApplicationConfiguration { | |
private[this] lazy val configuration = expensiveLoadOperation() | |
def get(excuse: Controller): ApplicationConfiguration = configuration | |
def get(excuse: ImportProvider): ApplicationConfiguration = configuration | |
} |