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.math._ | |
def calculatePoints(xvals: List[Double], func: Double=> (Double,Double) ) = xvals.map{ x => func(x)} | |
def calculateLengthOfPoints(points: List[(Double,Double)], length: Double): Double = { | |
def distance(p1: (Double,Double), p2: (Double,Double)) = | |
Math.sqrt(Math.pow(p2._1-p1._1,2)+Math.pow(p2._2-p1._2,2)) | |
points match { | |
case Nil => length | |
case point::rest if rest == Nil => calculateLengthOfPoints(rest, length) |
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 code.comet | |
import scala.xml.{NodeSeq, Text} | |
import net.liftweb._ | |
import http._ | |
import actor._ | |
import http.js._ | |
import JsCmds._ | |
import JE._ | |
import java.util.Date |
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
/*============================================================================================== | |
| All the classes in this file are used to built the Tempalte DSL. That means | |
| stuff like: | |
| | |
| injectContentsOfFile "path/to/file" into "myfile.txt" atPoint "MyPoint" | |
| | |
| HOWEVER currently I have to write it like this: | |
| | |
| injectContentsOfFile("src/test/resources/user_inject_Model_Point.txt").into("src/test/resources/model.txt").at("Point") | |
| |
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 com.sidewayscoding | |
import sbt._ | |
import org.lifty.engine._ | |
// the processor | |
class Processor extends SBTTemplateProcessor { | |
def templates = MyTemplate :: Nil | |
} |
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 sbt._ | |
class SampleSBTProcessor(info: ProjectInfo) extends ProcessorProject(info) { | |
val scalatools_snapshots = ScalaToolsSnapshots | |
val lifty_engine = "org.lifty" %% "lifty-engine" % "0.6.1" | |
} |
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
<%@ var name:String %> | |
Hello ${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
object MyOtherTemplate extends Template with Create { | |
def name = "goodbye" | |
def description = "Creates a file with a greeting and farewell in it" | |
def arguments = Argument("word") :: Nil | |
def files = Nil |
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
<%@ var name:String %> | |
Hello ${name} | |
//#inject point: farewell |
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
<%@ var word:String %> | |
So Long, and Thanks for All the ${word} |
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 sbt._ | |
class Project(info: ProjectInfo) extends DefaultProject(info) | |
{ | |
lazy val sctags = compileWithSctags | |
protected def compileWithSctags = task { | |
val compilerConfig = new MainCompileConfig { | |
override def baseCompileOptions = CompileOption("-Xplugin:sctags_2.8.0.Beta1-RC2-1.0.jar") :: super.baseCompileOptions.toList |
OlderNewer