This file contains 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 spark | |
import org.apache.spark | |
import org.apache.spark.rdd.RDD | |
import org.apache.spark.SparkConf | |
object SparkExamplesMinimal { | |
def asInt(s: String): Option[Int] = { | |
try { | |
Some(Integer.parseInt(s)) |
This file contains 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
<!-- paste this into the head element of an HTML file to append QR codes to each link --> | |
<script src="http://code.jquery.com/jquery-1.11.2.min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.qrcode/1.0/jquery.qrcode.min.js"></script> | |
<script type="text/javascript"> | |
$(document).ready(function(){ | |
$("a").each(function(idx, item){ | |
var a = $(item); | |
var href=a.attr("href"); | |
a.qrcode({ | |
text: href, |
This file contains 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 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 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 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 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 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 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 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 |
OlderNewer