Skip to content

Instantly share code, notes, and snippets.

View withoutclass's full-sized avatar

Matt Langreder withoutclass

  • Venmo
  • Chicago, IL
View GitHub Profile

Keybase proof

I hereby claim:

  • I am withoutclass on github.
  • I am withoutclass (https://keybase.io/withoutclass) on keybase.
  • I have a public key ASDxPxeGy1p-OqMrfDkQe_-1biAeIKAeuu_IXJMhwzqK3wo

To claim this, I am signing this object:

@withoutclass
withoutclass / CoroutineCallAdapterFactory.kt
Created April 18, 2018 14:34
Modification of Retrofit Coroutine adapter for returning `Either` type, from the Arrow-kt library. This was modified from Jake Wharton's version of the CoroutineCallAdapterFactory.
/*
* Copyright (C) 2016 Square, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@withoutclass
withoutclass / App.kt
Last active December 14, 2017 15:19
Vertx API without awaitResult
class App : CoroutineVerticle() {
suspend override fun start() {
... // setup
router.post("/ingredientCR").coroutineHandler { ctx -> addIngredientCoroutine(ctx) }
awaitResult<HttpServer> {
vertx.createHttpServer()
.requestHandler(router::accept)
.listen(config.getInteger("http.port", 8080), it)
}
@withoutclass
withoutclass / App.kt
Created December 8, 2017 14:31
Vertx Coroutine Server failing to hand back post params/body
class App : CoroutineVerticle() {
suspend override fun start() {
// Build Vert.x Web router
val router = Router.router(vertx)
router.post("/ingredient").coroutineHandler { ctx -> addIngredient(ctx) }
router.get("/").coroutineHandler { ctx -> ctx.response().end("Hello dude") }
// Start the server
awaitResult<HttpServer> {
vertx.createHttpServer()