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 net.liftweb.mongodb.record.field.ObjectIdField | |
import net.liftweb.mongodb.record.{MongoMetaRecord, MongoRecord} | |
import net.liftweb.record.field.IntField | |
// ==== BASE | |
trait BaseDoc[T <: BaseDoc[T]] extends MongoRecord[T] { | |
self: T => |
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 com.foursquare.rogue.LiftRogue._ | |
import net.liftweb.mongodb.record.{MongoRecord, MongoMetaRecord} | |
// ==== BASE | |
trait BaseDoc[T <: MongoRecord[T]] | |
extends MongoRecord[T] { | |
self: T => |
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._ | |
import Keys._ | |
object HelloBuild extends Build { | |
lazy val root = Project(id = "hello", | |
base = file("."), | |
settings = Project.defaultSettings ++ Seq(compileInputs in doc in Compile ~= (x => x.copy(config = x.config.copy(sources = List()))))) | |
} |
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 play.api.libs.json.Json | |
case class MyClass(id: Int, text: String) | |
object MyClass { | |
implicit val mailRead = Json.reads[MyClass] | |
def apply(id: Int) = | |
apply(id, "") |
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
// Library | |
// ================================================= | |
trait ConfigComp { | |
trait Config { | |
def get(k: String): String | |
} | |
def config: Config | |
} |
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
// counts number of vars in Tree | |
def countVars(implicit codeTree: List[Tree]): (String, Int) = | |
("noOfVars", codeTree.collect { | |
case e: ValDef if (e.mods.hasFlag(MUTABLE)) => true | |
}.size) | |
// overwrites field of Task trait | |
def metaField(name: String, value: Int) = | |
ValDef(Modifiers(OVERRIDE), newTermName("_" + name), TypeTree(), Literal(Constant(value))) |
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
trait Testable { | |
var _tasks = mutable.Map[Int, Task]() | |
def registerTask(num: Int, t: Task) { | |
_tasks(num) = t | |
} | |
def task(num: Int)(code: Any): Any = | |
macro TaskMacro.task |
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
class Task { | |
val _raw = "" | |
val _source = "" | |
val _noOfIfs = 0 | |
val _noOfVars = 0 | |
val _noOfVals = 0 | |
val _noOfDefs = 0 | |
val _noOfTrys = 0 |
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
task(2) { | |
def isWorkingDay(day: String) = { | |
var res: Boolean = false | |
day match { | |
case "Monday" => | |
res = true | |
case "Tuesday" => | |
res = true | |
case "Wednesday" => |
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
project.categories.query(c => c.ancestors.where(_.id === rootId)) |