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
/** my projects are named GuinePigModels, GuineaPigController, etc */ | |
private val myProjectsPrefix = "GuineaPig" | |
/** jar names appear on lines which may end by a comma followed by a line continuation mark */ | |
private val jarRef = """^([A-Za-z0-9_.\-]+)(\.jar)(,\\)*""".r | |
/** list files recursively */ | |
private def listOfFiles(dir: File): Seq[File] = { | |
if (dir.exists && dir.isDirectory) { | |
dir.listFiles.filter(f => f.isFile).toList |
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 EvaluationSupport { | |
import sbt._ | |
protected def fail(errorMessage: String, state: State): Nothing = { | |
state.log.error(errorMessage) | |
throw new IllegalArgumentException() | |
} | |
protected def log(implicit state: State) = state.log |
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 Logger { | |
def log(msg: String) | |
def info(msg: String) { log("INFO: " + msg) } | |
def warn(msg: String) { log("WARN: " + msg) } | |
def severe(msg: String) { log("SEVERE: " + msg) } | |
} | |
trait FileLogger extends Logger { | |
val filename: String | |
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 Logger { | |
def log(msg: String) | |
def info(msg: String) { log("INFO: " + msg) } | |
def warn(msg: String) { log("WARN: " + msg) } | |
def severe(msg: String) { log("SEVERE: " + msg) } | |
} | |
trait FileLogger extends Logger { | |
val filename: String | |
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
#!/bin/bash | |
#-*- mode: scala; -*- | |
exec java \ | |
-Dsbt.main.class=sbt.ScriptMain \ | |
-Dsbt.boot.directory=~/.sbt/boot \ | |
-Dsbt.log.noformat=true \ | |
-jar $(which sbt-launch.jar) $0 "+ $*" # see: https://github.com/sbt/sbt/issues/2257 | |
!# | |
/*** |
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
#!/bin/bash | |
## NOTE: This script is deprecated! | |
## See: https://github.com/frgomes/bash-scripts/blob/master/user-install/install-jupyter.sh | |
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
def matches(text: String, is: InputStream = System.in): Int = | |
scala.io.Source.fromInputStream(is) | |
.getLines | |
.toStream | |
.map(line => if(line.contains(text)) 1 else 0) | |
.reduce(_ + _) |
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
#!/bin/bash | |
# ---- Location where all tools are installed ---- | |
TOOLS_HOME=/opt/developer | |
# ---- These tools are available in the PATH ---- | |
JAVA_VERSION=1.8.0_101 | |
SCALA_VERSION_MAJOR=2.11 | |
SCALA_VERSION=${SCALA_VERSION_MAJOR}.8 | |
ANT_VERSION=1.9.6 |
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 flavour is pure magic... | |
def toDouble: (Any) => Double = { case i: Int => i case f: Float => f case d: Double => d } | |
// whilst this flavour is longer but you are in full control... | |
object any2Double extends Function[Any,Double] { | |
def apply(any: Any): Double = | |
any match { case i: Int => i case f: Float => f case d: Double => d } | |
} | |
// like when you can invoke any2Double from another similar conversion... |
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
for(row <- sheet.rows if (row.index == index); Cell(cindex, data) <- row.cells) yield { (cindex, data) } |