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
val entries = readings collect { | |
case r if sensorNames.contains(r.sensor) => (str2date(r.date), sensorNames(r.sensor), r.metric) | |
} |
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
@Test | |
public void test_singleProductRequested() { | |
production(10, "Gas", "mcf/d", "2013-01-01", "2014-01-01", 1000.0); | |
txn.dataBuilder().shrinkage(_project).assetProduct(_asset, "Gas").shrinkage(2013, 3, 1.0) | |
.shrinkage(2013, 6, 0.0).end(); | |
_test // | |
.raw("mcf", "Gas") // | |
.sales("mcf", "Gas") // |
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
private def send(invitation: Invitation, to: User, emailer: Emailer) = { | |
val url = s"${Application.configuration.baseUrl}/${invitation.id}" | |
val htmlBody = template.replace("{{url}}", url) | |
emailer.send(user.email, invitation.subject, htmlBody) | |
} |
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 Application { | |
lazy val configuration: ApplicationConfiguration = expensiveLoadOperation() | |
} |
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
class InvitationApi() extends Controller { | |
def invite() = Action(parse.json) { request => | |
val payload = request.body.as[UserId] | |
val baseUrl = ApplicationConfiguration.get(this).baseUrl | |
sendInvitation(payload.userId, baseUrl) match { | |
case Success(invitation) => Ok | |
case Failure(e) => BadRequest(e.getMessage) | |
} | |
} |
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 | |
} |
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
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
# 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
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 |