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
tasks.register<Copy>("downloadDependencies") { | |
from(configurations.runtimeClasspath) | |
into("local-repo/jars") | |
} | |
tasks.register("downloadDependenciesWithMetadata") { | |
doLast { | |
configurations.runtimeClasspath.get().resolvedConfiguration.resolvedArtifacts.forEach { artifact -> | |
val moduleVersion = artifact.moduleVersion.id | |
val group = moduleVersion.group.replace(".", "/") |
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
rbenv is a Ruby version manager that allows you to install multiple versions of Ruby and switch between them. Follow the steps below to install Ruby using rbenv. | |
Install all required dependencies for the ruby-build plugin to download and compile Ruby. | |
console | |
Copy | |
$ sudo apt install autoconf patch build-essential rustc libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libgmp-dev libncurses5-dev libffi-dev libgdbm6 libgdbm-dev libdb-dev libtool uuid-dev | |
Install the latest rbenv installation script. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
// This is our map type | |
typealias FunctionalMap<K, V> = (K) -> V? | |
// An empty map never has the value | |
fun <K, V> emptyMap(): FunctionalMap<K, V> = { _ -> null } | |
// Match the key to the value or fallback | |
fun <K, V> FunctionalMap<K, V>.put(key: K, value: V): FunctionalMap<K, V> = { k -> | |
if (k == key) value else this(k) | |
} |
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 AdjustableTickingClock( | |
private val startTime: Instant = EPOCH, | |
private val tick: Duration = Duration.ofSeconds(5) | |
) : Clock() { | |
private var currentTime = startTime | |
override fun getZone() = ZoneId.of("UTC") | |
override fun withZone(zone: ZoneId?) = this | |
override fun instant() = currentTime.also { currentTime += tick } |
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 org.http4k.example | |
import com.amazonaws.services.lambda.runtime.Context | |
import com.amazonaws.services.lambda.runtime.events.SQSEvent | |
import org.http4k.aws.AwsSdkClient | |
import org.http4k.client.JavaHttpClient | |
import org.http4k.core.HttpHandler | |
import org.http4k.core.Uri | |
import software.amazon.awssdk.auth.credentials.AwsBasicCredentials | |
import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider.create |
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 com.azure.core.http.HttpClient | |
import com.azure.core.http.HttpHeader | |
import com.azure.core.http.HttpHeaders | |
import com.azure.core.http.HttpRequest | |
import com.azure.core.http.HttpResponse | |
import org.http4k.core.Body | |
import org.http4k.core.Body.Companion.EMPTY | |
import org.http4k.core.HttpHandler | |
import org.http4k.core.Method | |
import org.http4k.core.Request |
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 org.http4k.contract.PreFlightExtraction | |
import org.http4k.contract.contract | |
import org.http4k.contract.meta | |
import org.http4k.core.Body | |
import org.http4k.core.Filter | |
import org.http4k.core.Method.POST | |
import org.http4k.core.Request | |
import org.http4k.core.Response | |
import org.http4k.core.Status.Companion.BAD_REQUEST | |
import org.http4k.core.Status.Companion.OK |
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 app1 = routes( | |
"/bob" bind GET to { Response(OK).body("you GET bob") }, | |
"/rita" bind POST to { Response(CREATED).body("you POST rita") } | |
) | |
val app2 = routes( | |
"/sue" bind DELETE to { Response(ACCEPTED).body("you DELETE sue") } | |
) | |
// we can compose the apps together into one large app here at the root, |
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
### Keybase proof | |
I hereby claim: | |
* I am daviddenton on github. | |
* I am daviddenton (https://keybase.io/daviddenton) on keybase. | |
* I have a public key ASBCXxFMUhDpkU0nuStiO7UXK879HTLE5CitEDuRXB9oyQo | |
To claim this, I am signing this object: |
NewerOlder