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
trait CompileMessageLogger extends Project { | |
override def logImpl: Logger = { | |
val logFile = (info.projectPath / "target" / "error").asFile | |
new MultiLogger(super.logImpl::new WarnAndErrorLogger(logFile):: Nil) | |
} | |
} |
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
#--------------------------------------------- | |
# TINT2 CONFIG FILE | |
#--------------------------------------------- | |
#--------------------------------------------- | |
# BACKGROUND AND BORDER | |
#--------------------------------------------- | |
rounded = 0 | |
border_width = 0 | |
background_color = #1c1c1c 100 |
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
#!/bin/bash | |
sbt "$@" | tee >( awk ' | |
BEGIN { | |
error_file = "target/error"; | |
} | |
END { | |
system("rm " error_file); | |
} |
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
require 'buildr/jetty' | |
require 'readline' | |
define "webapp" do | |
.... | |
task("jetty"=>[package(:war), jetty.use]) do |task| | |
jetty.deploy("http://localhost:8080", task.prerequisites.first) | |
Readline::readline('[Type ENTER to stop Jetty]') |
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.mortbay.jetty._ | |
import org.mortbay.jetty.webapp.WebAppContext | |
object MyServer { | |
def main(args: Array[String]) = { | |
val server = new Server(8080) | |
val webAppContext = new WebAppContext("src/main/webapp", "/") | |
webAppContext.setConfigurationClasses(Array[String]( | |
"org.mortbay.jetty.webapp.WebInfConfiguration", | |
"org.mortbay.jetty.webapp.WebXmlConfiguration" |
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
if (!args.isEmpty) { | |
println("Filename\t\tTotal\tBlack\tWhite") | |
args map to_file filter only_real_file foreach { file => | |
val image = javax.imageio.ImageIO.read(file) | |
val (height, width, total) = (image.getHeight, image.getWidth, image.getHeight*image.getWidth) | |
val rgbs = for (y <- 0 until height; x <- 0 until width) yield image.getRGB(x,y) | |
val black = rgbs map to_gray count if_under_threshold | |
println("%s\t\t%d\t%d\t%d" format (file.getName, total, black, total - black)) | |
} | |
} else { |
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.{Closeable, File, FileWriter, PrintWriter} | |
val rootDir = new File("/home/virasak/.vim") | |
if (!rootDir.exists) throw new IllegalArgumentException(rootDir + " does not exist") | |
val counts = scala.collection.mutable.Map.empty[String, Int] | |
for { | |
dir <- rootDir.listFiles.projection if dir.isDirectory && println("Processing " + dir) == () | |
file <- dir.listFiles if file.isFile | |
line <- scala.io.Source.fromFile(file, "ISO-8859-1").getLines |
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 Cli { | |
sealed abstract class EvalResult | |
object Exit extends EvalResult | |
case class ReadMore(lines: List[String]) extends EvalResult | |
case class PrintMe(result: (String => Unit) => Unit) extends EvalResult | |
def prompt(ps1: String, ps2: String)(eval: List[String] => EvalResult): Unit = { | |
def run(ps: String, acc: List[String]): Unit = eval(readLine(ps) :: acc) match { | |
case Exit => () | |
case ReadMore(lines) => run(ps2, lines) |
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
/* | |
* The web app uses the normal java servlet classes plus Jetty | |
*/ | |
import java.io.IOException; | |
import java.io.PrintWriter; | |
import javax.servlet.ServletException; | |
import javax.servlet.http.HttpServlet; | |
import javax.servlet.http.HttpServletRequest; | |
import javax.servlet.http.HttpServletResponse; |
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
/* | |
* The author disclaims copyright to this source code. In place of | |
* a legal notice, here is a blessing: | |
* | |
* May you do good and not evil. | |
* May you find forgiveness for yourself and forgive others. | |
* May you share freely, never taking more than you give. | |
* | |
*/ | |
package org.hibernate.dialect; |
NewerOlder