While Kotlin is not a pure functional language, it provides Higher order functions and an expressive way of writing programs vs statements provided by imperative languages like Java.
Function declaration
| [ | |
| {"isoCode": "AT", "name": "Austria"}, | |
| {"isoCode": "BE", "name": "Belgium"}, | |
| {"isoCode": "BG", "name": "Bulgaria"}, | |
| {"isoCode": "HR", "name": "Croatia"}, | |
| {"isoCode": "CY", "name": "Cyprus"}, | |
| {"isoCode": "CZ", "name": "Czech Republic"}, | |
| {"isoCode": "DK", "name": "Denmark"}, | |
| {"isoCode": "EE", "name": "Estonia"}, | |
| {"isoCode": "FI", "name": "Finland"}, |
| import javax.crypto.Mac | |
| import javax.crypto.spec.SecretKeySpec | |
| import org.apache.commons.codec.binary.Hex | |
| val sharedSecret = "whsec_A2EdfajGiGHx9jFmkP7ia6j25VXh9IWV" | |
| val payload = "{\n \"id\": \"evt_YEEz4JGN6UwGkCjdqr7wfPqL\",\n \"object\": \"event\",\n \"api_version\": \"2017-06-05\",\n \"created\": 1509023721,\n \"data\": {\n \"object\": {\n \"id\": \"my-first-test-plan\",\n \"object\": \"plan\",\n \"amount\": 599,\n \"created\": 1509023721,\n \"currency\": \"gbp\",\n \"interval\": \"month\",\n \"interval_count\": 1,\n \"livemode\": false,\n \"metadata\": {\n },\n \"name\": \"My first test plan\",\n \"statement_descriptor\": \"My first test plan\",\n \"trial_period_days\": 31\n }\n },\n \"livemode\": false,\n \"pending_webhooks\": 1,\n \"request\": {\n \"id\": \"req_6UwGkCjdqr7wfPqLAq\",\n \"idempotency_key\": null\n },\n \"type\": \"plan.created\"\n}" | |
| val header = "t=1509023726,v1=e786c1d46f2fa3bbd57cf974e89533ecb89b |
| import cats._ | |
| import cats.data.Validated.{Invalid, Valid} | |
| import cats.data.{ValidatedNel, _} | |
| import cats.implicits._ | |
| case class Person(name: String, jobTitle: String, age: Int) | |
| case class Error(msg: String) | |
| type ValidationResult[T] = ValidatedNel[Error,T] |
| package nicocavallo.contentful | |
| import java.time.ZonedDateTime | |
| import com.contentful.java.cda._ | |
| import com.typesafe.config.Config | |
| import org.reactivestreams.{Subscriber, Subscription} | |
| import scala.concurrent.{Future, Promise} | |
| import scala.language.postfixOps |
| param( | |
| $confPath = "./conf.txt" | |
| ) | |
| while (1) | |
| { | |
| $props = convertfrom-stringdata (get-content -path $confPath -raw) | |
| $period = [convert]::ToInt32($props.'app.interval', 10) |
This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.
###Array ####Definition:
| lazy val root = (project in file(".")) | |
| .enablePlugins(PlayScala, SbtLiquibase, BuildInfoPlugin) | |
| .settings( | |
| buildInfoKeys := Seq[BuildInfoKey](name, version, scalaVersion, sbtVersion, | |
| "buildNumber" -> Option(System.getenv("BUILD_NUMBER")).getOrElse("n/a"), | |
| "gitCommit" -> Option(System.getenv("GIT_COMMIT")).getOrElse("n/a"), | |
| "gitBranch" -> Option(System.getenv("GIT_BRANCH")).getOrElse("n/a") | |
| ), | |
| buildInfoPackage := "picsolve.jenkins.metadata", |