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
# I'm using Java 1.6 on Mac 10.7.2 | |
# The sbt7 command is a shell script to start sbt 0.7 defined as: | |
~$ more /opt/sbt7/sbt | |
java -XX:MaxPermSize=612m -Xmx912M $JAVA_OPTS $WITH_REBEL -jar `dirname $0`/sbt-launch.jar "$@" | |
~$ echo $JAVA_OPTS | |
-Dfile.encoding=utf8 |
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
object Unsubscribe { | |
/* A menu for Lift's Sitemap which maps /unsubscribe/{uuid} to two | |
functions: 1) given a uuid, lookup a Subscription instance | |
2) given a Subscription instance, create the link address... */ | |
val menu = Menu.param[Subscription]("Unsubscribed", "Unsubscribed", | |
uuid => Subscription.find(By(Subscription.uuid, uuid)), | |
s => s.uuid ) / "unsubscribed" >> Hidden | |
/* The Loc(ation) part of the menu is what we're going to work with... */ |
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
~$ vi ~/.sbt/plugins/build.sbt | |
~$ cat ~/.sbt/plugins/build.sbt | |
addSbtPlugin("org.lifty" % "lifty" % "1.7") | |
~$ cd tmp | |
tmp$ mkdir lt | |
tmp$ cd lt/ | |
lt$ sbt11 | |
############################################################# |
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
// In our case, we have /bookmarklet/{uuid}?title={page title}&url={page url} | |
// In Boot: | |
LiftRules.statelessDispatchTable.prepend(Bookmarklet.dispatch) | |
// The bookmarklet itself.... | |
object Bookmarklet extends Loggable { | |
def dispatch: LiftRules.DispatchPF = { |
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.example.project.snippet | |
import scala.xml._ | |
import net.liftweb.util.Helpers._ | |
/* Access to the build number (e.g., supplied by Hudson/Jenkins) | |
Example usage: | |
<lift:App.version> Project:<v:project/> Build:<v:number/> </lift:App.version> |
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 org.specs2.runner._ | |
import org.specs2.mutable._ | |
import org.junit.runner._ | |
import com.codecommit.antixml._ | |
@RunWith(classOf[JUnitRunner]) | |
class NoCigar extends Specification { |
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 bootstrap.liftmodules.GoogleAnalytics | |
import GoogleAnalytics.dsl._ | |
GoogleAnalytics.init { | |
only when S.cookieValue("cookie_consent").isDefined | |
} |
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
GoogleAnalytics.alertUser ( only when S.cookieValue("cookie_consent").isEmpty ) { | |
JsAlert("We set Cookies") | |
} |
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 bootstrap.liftmodules.GoogleAnalytics | |
import GoogleAnalytics.dsl._ | |
// Always track | |
GoogleAnalytics.init | |
// Provide a one-time banner, based on the absence of a cookie: | |
GoogleAnalytics.alertUser( only when( S.cookieValue("ckns_policy").isEmpty ) { | |
import net.liftweb.http.js._ | |
import JE._ |
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
for (int i = 0; i < resultFeed.getEntries().size(); i++) { | |
ContactEntry entry = resultFeed.getEntries().get(i); | |
if (entry.hasName()) { | |
Name name = entry.getName(); | |
if (name.hasFullName()) { | |
... |
OlderNewer