$ echo 'scalaVersion := "2.10.0-M7"' > build.sbt
$ sbt console
[info] Set current project to default-e9c0f6 (in build file:/Users/seratch/tmp/scala_2.10/)
Getting Scala 2.10.0-M7 ...
downloading http://repo1.maven.org/maven2/org/scala-lang/scala-compiler/2.10.0-M7/scala-compiler-2.10.0-M7.jar ...
[SUCCESSFUL ] org.scala-lang#scala-compiler;2.10.0-M7!scala-compiler.jar (2113ms)
downloading http://repo1.maven.org/maven2/org/scala-lang/scala-library/2.10.0-M7/scala-library-2.10.0-M7.jar ...
[SUCCESSFUL ] org.scala-lang#scala-library;2.10.0-M7!scala-library.jar (2921ms)
downloading http://repo1.maven.org/maven2/org/scala-lang/scala-reflect/2.10.0-M7/scala-reflect-2.10.0-M7.jar ...
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
| scala> case class SQLInterpolationResult[P](strings: Seq[String], param: P) | |
| defined class SQLInterpolationResult | |
| scala> class SQLInterpolation(val s: StringContext) extends AnyVal { | |
| | def sql[P](param: P) = new SQLInterpolationResult(s.parts, param) | |
| | } | |
| defined class SQLInterpolation | |
| scala> @inline implicit def interpolation(s: StringContext) = new SQLInterpolation(s) | |
| warning: there were 1 feature warnings; re-run with -feature for details |
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
| #!/usr/bin/env perl | |
| use strict; | |
| use warnings; | |
| package Seq; | |
| sub apply { | |
| my ($class, @seq) = @_; | |
| bless { seq => \@seq }, $class; |
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
| libraryDependencies ++= Seq( | |
| "com.github.seratch" %% "scalikejdbc" % "[1.3,)", | |
| "org.slf4j" % "slf4j-simple" % "1.6.4", | |
| "org.hsqldb" % "hsqldb" % "[2,)" | |
| ) |
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
| def redirect(arg) | |
| new_host = 'new.example.com' | |
| uri = arg["REQUEST_URI"] | |
| [ | |
| 302, | |
| {'content-type' => 'text/plain', 'location' => "http://#{new_host}#{uri}"}, | |
| "http://#{new_host}#{uri}".chars | |
| ] | |
| end | |
| run method(:redirect) |
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
| // http://www.eclipse.org/jgit/download/ | |
| resolvers += "jgit-repo" at "http://download.eclipse.org/jgit/maven" | |
| libraryDependencies += "org.eclipse.jgit" % "org.eclipse.jgit" % "[2.1,)" |
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 Tx { self: Controller => | |
| def localTx[A](action: Action[A]) = LocalTxActionDecorator[A](action) | |
| } | |
| case class LocalTxActionDecorator[A](action: Action[A]) extends Action[A] { | |
| def parser: BodyParser[A] = action.parser | |
| override def apply() = DB localTx { implicit s => action.apply() } |
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
| case class SQLRunner(sql: String) { | |
| def run(): Seq[Map[Symbol, Any]] = { | |
| try { | |
| SQL(sql).map(_.toSymbolMap()).list.apply() | |
| } catch { case e: java.sql.SQLException => | |
| val result = SQL(sql).execute.apply() | |
| Seq(Map('RESULT -> result)) | |
| } | |
| } | |
| } |
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
| access_key_id: xxx | |
| secret_access_key: yyy |
NOTE: The following is a Japanese translation for the guidelines of Typesafe Developer Contest.
http://typesafe.com/resources/developer-contest
Typesafe 社は、Scala、Akka または Play(もしくはそのすべて!)を使ったプログラミングのデモンストレーションとなる、素晴らしいアプリケーションを求めています。
このようなアプリケーションの例として提供できる、誇れるプログラムがありますか?もしあれば、あなたのエントリを心よりお待ちしております。
Martin Odersky が JAX Java Ambassador Award で獲得した賞金をこのコンテストに寄付しました。