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:
import com.googlecode.totallylazy.Callable1; | |
import com.googlecode.totallylazy.Callable2; | |
public class Lenses { | |
public static void main(String[] args) throws Exception { | |
Person rhys = new Person("rhys", 33, new Address("2 east lane", new Postcode("se16", "4uq"))); | |
Person older_rhys = personAgeLens().set(rhys, 34); |
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) |
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)) | |
} |
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", |
<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> |
I hereby claim:
To claim this, I am signing this object:
# 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)) |
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).
module Main where | |
import System.MIDI | |
import System.MIDI.Utility | |
import Control.Monad | |
import Data.Word | |
import Data.Char | |
main :: IO () | |
main = do |
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 |