I hereby claim:
- I am gaerfield on github.
- I am gaerfield (https://keybase.io/gaerfield) on keybase.
- I have a public key ASBdxOCKNyT49pL7_sIJChFDpXesopEFboq3SqnFRR195wo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
import java.io.File | |
/** Executes a shell-command and returns the result */ | |
fun String.exe(dir: File? = null): String { | |
val process = ProcessBuilder("/bin/sh", "-c", this) | |
.redirectErrorStream(true) | |
.directory(dir) | |
.start() | |
val exitCode = process.waitFor() | |
if(exitCode != 0) { |
inline fun <reified T> Any.cast() = | |
try { val toBeCasted = this; with(jacksonObjectMapper()) { readValue<T>(writeValueAsString(toBeCasted)) } } | |
catch (e: Exception) { throw ClassCastException("Can't convert from [${this::class}] to [${T::class}]:\n\t${e.message}") } | |
data class AClass(val name: String, val age: Int) | |
data class BClass(val name: String, val age: Int) | |
@Test | |
fun example(){ | |
val a = AClass("whoop", 42) |
#!/usr/bin/env kscript | |
@file:MavenRepository("jcenter","https://jcenter.bintray.com" ) | |
@file:DependsOn("io.ktor:ktor-server-netty:1.2.6") | |
import io.ktor.application.* | |
import io.ktor.http.* | |
import io.ktor.response.* | |
import io.ktor.routing.* | |
import io.ktor.server.engine.* |
package de.kramhal.coffeebutts | |
import de.kramhal.coffeebutts.Consumer.* | |
import de.kramhal.coffeebutts.FlowOperator.* | |
import de.kramhal.coffeebutts.Producer.* | |
import kotlinx.coroutines.* | |
import kotlinx.coroutines.channels.Channel | |
import kotlinx.coroutines.channels.consumeEach | |
import kotlinx.coroutines.channels.produce | |
import kotlinx.coroutines.flow.Flow |
package infrastructure | |
import kotlinx.coroutines.* | |
import kotlinx.coroutines.channels.ConflatedBroadcastChannel | |
import kotlinx.coroutines.flow.* | |
internal class EventBus { | |
// Initialize the bus with an empty Event, so we can drop the first element everytime on a new subscription | |
// This is neccesary, because on subscription usually the current element is send (although it was added | |
// before subscription) |
import java.io.File | |
import kotlin.reflect.KClass | |
object Resources { | |
/** | |
* Loads a resource from within the resources-Folder (usually src/main/resources): | |
* ``` | |
* val resource : File = this::class.resourceFile("myResource.xml") | |
* ``` | |
*/ |
GraphQL vs. REST vs. RPC
REST is a concept to decouple server and client by providing an API providing access to server-side data as ressources and provide methods to change these ressources.
RPC on the other hand is a binary protocol for invoking Procedure at a remote-Computer. In its simplest form an port is opened processing data in an closed binary protocol. A more standard-approach would be using SOAP+XML.
GraphQL is a Query-Language, specification and set of tools operating on a single http-endpoint. With the query-language the client is allowed to define, which data it wishes to receive and thus possibly reducing the number of requests and the amount of data to be send.
With Spring-Boot and several other frameworks REST-endpoints are very easy to implement and allowing a good access to a domain-model. Some kind of operations don't act on a single ressource. They don't result in creating a new ressource or they maybe changing multiple ressources at once. Such operations are easier to implement as R