Skip to content

Instantly share code, notes, and snippets.

View lanceon's full-sized avatar

Oleksiy lanceon

View GitHub Profile
@lanceon
lanceon / JsBSONHandlers.scala
Created October 14, 2015 18:39 — forked from nevang/JsBSONHandlers.scala
Reader and writer in order to work with spray-json and reactivemongo. Based on https://github.com/zenexity/Play-ReactiveMongo.
import spray.json._
import reactivemongo.bson._
import reactivemongo.bson.handlers.{ BSONReader, BSONWriter, RawBSONWriter }
import scala.util.{ Try, Success, Failure }
import org.apache.commons.codec.binary.Hex
import org.joda.time.format.ISODateTimeFormat
import org.joda.time.{ DateTime, DateTimeZone }
import java.nio.ByteBuffer
import org.jboss.netty.buffer.ChannelBuffers
@lanceon
lanceon / Main.scala
Last active August 29, 2015 14:10 — forked from xuwei-k/Main.scala
package scalaz_memo_example
import scala.util.control.Exception.allCatch
import scalaz._
import Scalaz._
object Main{
def timer[T](f : => T):T = {
val start = System.currentTimeMillis
@lanceon
lanceon / gist:81828065159826781795
Last active August 3, 2022 07:47 — forked from cvogt/gist:9239494
Slick cheat sheet
// Please comment in case of typos or bugs
import scala.slick.driver.H2Driver._
val db = Database.for...(...)
case class Record( ... )
class Records(tag: Tag) extends Table[Record](tag,"RECORDS"){
...
def * = ... <> (Record.tupled,Record.unapply)
// place additional methods here which return values of type Column
// Import the magic libraries
import scala.xml._
import scala.xml.transform._
// Source xml. In Scala, xml is literal.
val xml =
<user>
<email>joe@example.com</email>