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
| /* | |
| * This code shows in a prototypical manner how to create a user | |
| * in an LDAP directory using the code from the lift-ldap package, | |
| * including salted SHA1 (SSHA) passwords. | |
| * | |
| * The Java code from | |
| * http://stackoverflow.com/questions/8176001/trouble-creating-active-directory-users-with-java | |
| * was used as a template, kudos! | |
| */ |
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
| /* | |
| * Let's assume we have an XML fragment in Scala like: | |
| * <entry xmlns="http://www.w3.org/2005/Atom"> | |
| * <content xmlns="http://mysite.com/xml/someSchema"> | |
| * Hello <name>you</name>! | |
| * </content> | |
| * </entry> | |
| * Then (_ \ "content") will leave you with: | |
| * <content xmlns="http://mysite.com/xml/someSchema" xmlns="http://www.w3.org/2005/Atom"> | |
| * Hello <name>you</name>! |
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 java.io._ | |
| import java.util.Date | |
| import java.text.SimpleDateFormat | |
| import scala.io.Source | |
| import net.liftweb.json._ | |
| import net.liftweb.util.Helpers._ | |
| object Zinnia2Ikiwiki extends Application { |
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 author extends ObjectIdRefListField(this, MongoTerm) | |
| with One2ManyCRUD[BsonMetadata, MongoTerm] { | |
| override def options = MongoTerm.findAll(("category" -> "person")).map(x => (x.id.is, x.title)) | |
| } | |
| // ... |
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 author extends ObjectIdRefListField(this, MongoTerm) | |
| with One2ManyCRUD[BsonMetadata, MongoTerm] { | |
| override def searchMeta = MongoTerm | |
| override def definingQuery = ("category" -> "person") | |
| } | |
| // ... |
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
| tryo { | |
| MyMailer.sendMail( | |
| MyMailer.From("info@mysite.de"), | |
| MyMailer.Subject(subject), | |
| (MyMailer.MessageHeader("Date", now.toGMTString()) :: | |
| MyMailer.PlainPlusBodyType(formattedContent, "utf-8") :: | |
| MyMailer.XHTMLMailBodyType(htmlContent) :: | |
| recipients.map(MyMailer.To(_)) | |
| ): _*) | |
| } match { |
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 scala.xml.Text | |
| import scala.annotation.tailrec | |
| import net.liftweb.mapper._ | |
| import net.liftweb.sitemap._ | |
| import net.liftweb.common._ | |
| import net.liftweb.http._ | |
| import net.liftweb.util.Helpers._ | |
| import net.liftweb.sitemap.Menu.ParamExtractor | |
| import eu.vismath.web.lib._ |
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.scalatest._ | |
| import org.scalatest.time._ | |
| import org.scalatest.selenium._ | |
| import org.openqa.selenium._ | |
| import org.mortbay.jetty.Server | |
| import org.mortbay.jetty.webapp.WebAppContext | |
| import org.apache.log4j.Logger | |
| trait JettySetup extends FlatSpec | |
| with BeforeAndAfterAll |
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
| /** | |
| * Carries some page content. | |
| */ | |
| class Content extends MongoRecord[Content] | |
| with ObjectIdPk[Content] | |
| with Versioned[Content, ContentRevision] { | |
| def meta = Content | |
| def revisionMeta = ContentRevision | |
| // ... | |
| } |
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
| class EndlessList { | |
| /** | |
| * Gets a "page" (e.g., 10 items) of content entities from the database. | |
| */ | |
| def getPage(page: Int): (Seq[Content], Boolean) = { | |
| val realPage: Int = if (page < 1) 1 else page | |
| val limit = 10 | |
| val contents = Content.findAll( | |
| (/* conditions */), |
OlderNewer