Skip to content

Instantly share code, notes, and snippets.

View eltimn's full-sized avatar
🌏

Tim Nelson eltimn

🌏
View GitHub Profile
@eltimn
eltimn / gist:795373
Created January 25, 2011 18:41
Joda Period Field
import org.joda.time.{DateTime, DateTimeConstants, Period => JodaPeriod}
import org.joda.time.format.ISOPeriodFormat
object waiverSetting extends StringField(this, 32) {
override def optional_? = true
override def displayName = "Waiver Period"
val periodFormatter = ISOPeriodFormat.standard
override def defaultValue = periodFormatter.print(new JodaPeriod)
def period: JodaPeriod = periodFormatter.parsePeriod(value)
def setFromForm(d: Int, h: Int, m: Int) = setBox(Full(
@eltimn
eltimn / Boot.scala
Created May 7, 2010 14:40 — forked from tbje/Boot.scala
Scheduled Tasks via Actor
import net.liftweb.util.ActorPing
import net.liftweb.common.Logger
class Boot extends Logger {
def boot {
// where to search snippet
LiftRules.addToPackages("your.package")
...
val myActor = new MyActor
myActor ! Msg
@eltimn
eltimn / H2 DBVendor
Created August 12, 2009 19:16
H2 connection manager for Lift app
H2 has it's own connection pool manager that H2 claims [1] is faster than using
DriverManager.getConnection(). Here's how to configure it for use in a Lift app.
/**
* H2 db connection manager
*/
object H2DBVendor extends ConnectionManager {
// create the connection pool
private val cp = org.h2.jdbcx.JdbcConnectionPool.create(
@eltimn
eltimn / H2 Console Servlet
Created August 12, 2009 18:58
Settings for using H2 console servlet in a Lift app
To use the H2 console servlet in your Lift app add the following to your web.xml
and Boot.scala files. Then you can access it via /console.
web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">