If so, can you give me some advice on how to do standard http transaction boundary stuff. That is
* unpack request
* get stuff from db
* update db based on request
* return request
all this in a single transaction (succeed/fail).
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 cats.data.{Kleisli, ReaderT} | |
import cats.effect.IO | |
import org.http4s.client.{Client, DisposableResponse} | |
import org.http4s.dsl.Http4sDsl | |
import org.http4s.{HttpService, Request} | |
class Something(client: Client[IO]) extends Http4sDsl[IO] { | |
private val service = | |
new ServiceThatKnowsNothingAboutTracing(new TracingAwareHttpClient(client)) |
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 cats.effect.IO | |
import cats.implicits._ | |
import org.http4s.HttpService | |
import org.http4s.Method.{GET, POST} | |
import org.http4s.Uri.uri | |
import org.http4s.client.blaze.Http1Client | |
import org.http4s.client.middleware.Logger | |
import org.http4s.client.dsl.io._ | |
import org.http4s.dsl.io._ | |
import org.http4s.server.blaze.BlazeBuilder |
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
module Main where | |
import System.MIDI | |
import System.MIDI.Utility | |
import Control.Monad | |
import Data.Word | |
import Data.Char | |
main :: IO () | |
main = do |
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
# pip install soco | |
import soco | |
import time | |
start_time = time.time() | |
sonos_zones = list(soco.discover()) | |
while True: | |
time.sleep(0.25 - ((time.time() - start_time) % 0.25)) |
I hereby claim:
- I am rhyskeepence on github.
- I am rhysk (https://keybase.io/rhysk) on keybase.
- I have a public key whose fingerprint is 4690 25C8 D371 86B2 A7BB 309A 20D2 798D 40AB 4BCE
To claim this, I am signing this object:
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
<html> | |
<head> | |
<link rel="stylesheet" href="codemirror/lib/codemirror.css"> | |
<link rel="stylesheet" href="codemirror/addon/lint/lint.css"> | |
<link rel="stylesheet" href="codemirror/addon/dialog/dialog.css"> | |
<script src="codemirror/lib/codemirror.js"></script> | |
<script src="codemirror/addon/lint/lint.js"></script> |
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 sky.sns.jibberjabber | |
import org.squeryl.{Schema, Session} | |
import org.squeryl.adapters.OracleAdapter | |
import org.squeryl.PrimitiveTypeMode._ | |
object Connectaroo extends App { | |
val database = Database( | |
driver = "oracle.jdbc.driver.OracleDriver", |
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 example | |
object Stereotypes { | |
val stereotypes = Seq(australia, newzealand, preston, liverpool, manchester) | |
def find(name: String): Either[String, Stereotype] = { | |
stereotypes | |
.find(stereotype => stereotype.names.exists(name.equalsIgnoreCase)) | |
.toRight("Invalid Stereotype [%s]. Must be one of [%s]".format(name, allPossibleStereotypes)) | |
} |
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.specs2.matcher | |
object ExtraOptionMatchers { | |
def beSomeMatching[T](someValueMatcher: =>Matcher[T]) = new Matcher[Option[T]] { | |
def apply[S <: Option[T]](value: Expectable[S]) = value.value match { | |
case Some(x) => matchSome(value) | |
case None => MatchFailure( | |
value.description + " is Some", | |
value.description + " is not Some", | |
value) |
NewerOlder