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 janrain | |
| class Foo extends Function0[Unit] { | |
| def apply() { | |
| println("Called FOO") | |
| println(RedisSetup) | |
| } | |
| } |
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 Java::ScalaCollection::TraversableOnce | |
| include Enumerable | |
| def each(&f) | |
| foreach(f) | |
| end | |
| # Cribbed from | |
| # https://github.com/scala/scala/blob/v2.9.2/src/library/scala/collection/TraversableOnce.scala#L231 | |
| def to_a |
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
| def unfold[Z: Zero](z:Z) = z == ∅[Z] !? z.some |
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.scalatra.servlet | |
| import java.io.{NotSerializableException, OutputStream, ObjectOutputStream} | |
| import javax.servlet.http.{HttpSessionAttributeListener, HttpSessionBindingEvent} | |
| object NullOut extends OutputStream { | |
| def write(b: Int) {} | |
| } | |
| object SessionSerializingListener extends HttpSessionAttributeListener { |
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.scalatra.servlet | |
| import javax.servlet.http.HttpSession | |
| trait TestImplicits extends ServletApiImplicits { | |
| override implicit def enrichSession(session: HttpSession): TestSerializationSession = | |
| new TestSerializationSession(session) | |
| } |
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 net.liftweb.json.{Extraction, DefaultFormats} | |
| object Main { | |
| implicit val formats = DefaultFormats | |
| val p = Person("Leif", 33) | |
| def main(args:Array[String]) { | |
| val dp = Extraction decompose p |
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.scalatra | |
| package liftjson | |
| import scala.xml.XML | |
| import net.liftweb.json._ | |
| import net.liftweb.json.Xml.toXml | |
| trait JsonSupport extends ApiFormats { | |
| /** |
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.scalatra | |
| package liftjson | |
| import scala.xml.XML | |
| import net.liftweb.json._ | |
| import net.liftweb.json.Xml.toXml | |
| trait JsonSupport extends ApiFormats { | |
| /** |
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
| def sql[T](q: String)(f: ResultSet => T): Either[List[Throwable], T] = (for { | |
| connection <- managed( datasource.getConnection ) | |
| statement <- managed( connection.createStatement ) | |
| resultSet <- managed( statement.executeQuery(q) ) | |
| } yield resultSet).acquireFor(f) |
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 foo | |
| class Crash { | |
| def foo = | |
| try | |
| err | |
| catch { | |
| case e:Exception => | |
| e.printStackTrace | |
| } |