- By Edmond Lau
- Highly Recommended 👍
- http://www.theeffectiveengineer.com/
- They are the people who get things done. Effective Engineers produce results.
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) | |
} | |
} |
object Application { | |
lazy val configuration: ApplicationConfiguration = expensiveLoadOperation() | |
} |
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) | |
} |
@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") // |
val entries = readings collect { | |
case r if sensorNames.contains(r.sensor) => (str2date(r.date), sensorNames(r.sensor), r.metric) | |
} |
#install.packages("jsonlite") | |
library(jsonlite) | |
#install.packages("httpuv") | |
library(httpuv) | |
#install.packages("httr") | |
library(httr) | |
# Can be github, linkedin etc depending on application | |
oauth_endpoints("github") |
I hereby claim:
To claim this, I am signing this object:
import subprocess | |
def solve_it(input_data): | |
cmd = "java -jar ./anyint-scala/target/scala-2.12/anyint.jar " + input_data | |
p = subprocess.Popen( | |
cmd, | |
stdout=subprocess.PIPE, | |
stderr=subprocess.PIPE, | |
shell=True) |
package io.citrine.orion.core.domain | |
import io.citrine.testing.BaseUnitTest | |
import scala.collection.mutable.ListBuffer | |
class BusinessRuleTest extends BaseUnitTest { | |
trait StatusInfo { | |
def write(msg: String) |