Skip to content

Instantly share code, notes, and snippets.

@corruptmemory
corruptmemory / keybase.md
Created July 9, 2020 22:13
Keybase proof

Keybase proof

I hereby claim:

  • I am corruptmemory on github.
  • I am corruptmemory (https://keybase.io/corruptmemory) on keybase.
  • I have a public key ASADP44V3RkEhpkaizyW9Xn2Cn0PCK-bUcydzBbhJSUjHQo

To claim this, I am signing this object:

@corruptmemory
corruptmemory / gist:1661131
Created January 23, 2012 06:18
blueeyes PONG
package com.corruptmemory.blueeyes_pong
import akka.dispatch.{Future,Promise}
import akka.util.Timeout
import blueeyes.{BlueEyesServer,BlueEyesServiceBuilder}
import blueeyes.core.data.FileSource._
import blueeyes.core.data.{FileSource, ByteChunk, BijectionsChunkJson, BijectionsChunkString, BijectionsChunkFutureJson}
import blueeyes.core.http.HttpStatusCodes._
import blueeyes.core.http.MimeTypes._
import blueeyes.core.http.combinators.HttpRequestCombinators
@corruptmemory
corruptmemory / gist:1610096
Created January 14, 2012 03:14
Yesod/Haskell PONG
{-# LANGUAGE OverloadedStrings, QuasiQuotes, TypeFamilies, TemplateHaskell, MultiParamTypeClasses #-}
import Yesod.Dispatch
import Yesod.Core
import Yesod.Content
import Data.ByteString (ByteString)
import Network.Wai.Handler.Warp (run)
data Pong = Pong
mkYesod "Pong" [$parseRoutes|
/ PongR GET
@corruptmemory
corruptmemory / gist:1609921
Created January 14, 2012 02:16
Warp/Haskell PONG
{-# LANGUAGE OverloadedStrings #-}
import Network.Wai
import Network.Wai.Handler.Warp
import Blaze.ByteString.Builder (fromByteString)
import Network.HTTP.Types (status200)
main = run 3000 $ const $ return $ ResponseBuilder
status200
[("Content-Type", "text/plain"), ("Content-Length", "4")]
$ fromByteString "PONG"
@corruptmemory
corruptmemory / gist:1609875
Created January 14, 2012 02:02
Unfiltered pong
package com.patch.unfiltered_pong
import unfiltered.request._
import unfiltered.response._
import unfiltered.netty.async._
import org.jboss.netty.channel.ChannelHandlerContext
import unfiltered.netty.ServerErrorResponse
trait ApiPlan extends Plan with ServerErrorResponse {
@corruptmemory
corruptmemory / silly.rkt
Created December 1, 2011 18:11
define-type is just a type alias...
#lang typed/racket
(define-type A (U String Integer))
(define-type B (U Integer))
(define-type D (U String Real Integer))
(: foo (A -> Integer))
(define (foo a)
(cond [(string? a) (string-length a)]
[(integer? a) a]))
@corruptmemory
corruptmemory / Overlap.scala
Created November 30, 2011 20:30
Outline of overlapping shape tester...
case class Point(x:Double,y:Double)
case class Rectangle(p1:Point,p2:Point) {
def overlaps(that:Rectangle):Boolean =
// Rectangle overlap test
}
trait Overlapable {
def boundingRectangle:Rectangle
def convexHulls:Seq[Seq[Point]]
def overlaps(that:Seq[Seq[Point]]):Boolean
Originally:
https://gist.github.com/7565976a89d5da1511ce
Hi Donald (and Martin),
Thanks for pinging me; it's nice to know Typesafe is keeping tabs on this, and I
appreciate the tone. This is a Yegge-long response, but given that you and
Martin are the two people best-situated to do anything about this, I'd rather
err on the side of giving you too much to think about. I realize I'm being very
critical of something in which you've invested a great deal (both financially
@corruptmemory
corruptmemory / DBSkeisli.scala
Created October 17, 2011 02:43
Silly example of Kleisli composition of DB operations
/**
* A silly example using Kleisli composition of DB operations
* Based on an idea from Runar Bjarnason found here:
* https://groups.google.com/d/msg/scala-debate/xYlUlQAnkmE/FteqYKgo2zUJ
*
* Uses Scalaz7
*
* @author <a href="mailto:jim@corruptmemory.com">Jim Powers</a>
*/
object Monadic {