Skip to content

Instantly share code, notes, and snippets.

View andyczerwonka's full-sized avatar

Andy Czerwonka andyczerwonka

View GitHub Profile
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)
}

Effective Engineer - Notes

What's an Effective Engineer?

  • They are the people who get things done. Effective Engineers produce results.

Adopt the Right Mindsets

@andyczerwonka
andyczerwonka / R_Github_Api.R
Created January 20, 2018 13:59 — forked from mGalarnyk/R_Github_Api.R
Reading Data From GitHub API Using R. This code was originally for the John Hopkins Data Science Specialization. Blog on it https://medium.com/@GalarnykMichael/accessing-data-from-github-api-using-r-3633fb62cb08#.toufbbjgd
#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")

Keybase proof

I hereby claim:

  • I am andyczerwonka on github.
  • I am andyczerwonka (https://keybase.io/andyczerwonka) on keybase.
  • I have a public key whose fingerprint is EFC2 5E51 4624 1F09 9816 4206 8E6B 8028 281F 91B1

To claim this, I am signing this object:

@andyczerwonka
andyczerwonka / solver.py
Created July 19, 2018 22:27
Errors with the submit process
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)
@andyczerwonka
andyczerwonka / BusinessRuleThoughts.scala
Created June 13, 2020 14:25
Discussion around an API that could collect failures and success
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)