Skip to content

Instantly share code, notes, and snippets.

@skipoleschris
skipoleschris / SSLCommunications.scala
Created February 16, 2012 08:48
Trait for doing SSL with mutual certificate exchange using dispatch http
import java.security._
import java.net.URL
import javax.net.ssl.{KeyManagerFactory, TrustManagerFactory}
import org.apache.http.conn.ssl.SSLSocketFactory
import org.apache.http.conn.scheme.Scheme
import dispatch._
// Gist trait for doing SSL with mutual certificate exchange using dispatch.
// This works without having to set up global JDK-wide keystore and truststore files.
//
@skipoleschris
skipoleschris / TypeClassExamples.scala
Created September 28, 2011 11:47
Examples of implementing Type Classes in Scala
trait Publishable {
def asWebMarkup: String
}
case class BlogPost(title: String, text: String) extends Publishable {
def asWebMarkup =
"""|<h2>%s</h2>
|<div>%s</div>""".stripMargin format(title, text)
}