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
AA 100円 | |
BB 300円 | |
CC 200円 | |
DD 400円 | |
EE 500円 |
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 CSVImplicits { | |
implicit def toCSVIterator(it: Iterator[String]): toCSVIterator = new toCSVIterator(it) | |
class toCSVIterator(it: Iterator[String]) { | |
def asCSV: CSVIterator = new CSVIterator(it) | |
} | |
} |
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 scala.util.{ Try, Success } | |
import scala.util.control.Exception._ | |
object Main extends App { | |
val result = for { | |
i <- Try("abc".toInt) recover { | |
case e: NumberFormatException => 1 | |
} | |
j <- Try("2".toInt) |
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 sawk | |
import scala.io.Source | |
import scala.collection.mutable.Map | |
object Sawk { | |
def apply(script: SawkScript): Unit = { | |
script.run | |
} | |
} |
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 org.squeryl.annotations.Column | |
import org.squeryl.PrimitiveTypeMode._ | |
import org.squeryl.{ Session, SessionFactory, Schema, KeyedEntityDef } | |
import org.squeryl.adapters.{ PostgreSqlAdapter } | |
import java.util.Date | |
object KeyedEntityDefsExample extends App { | |
class Member ( | |
val name: 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
import scalaz._, Scalaz._ | |
case class User(id: String, pass: String) | |
object Main extends App { | |
implicit object userShow extends Show[User] { | |
def show(u: User) = u.toString.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
s = "abc:123" | |
p = /(?<alpha>[a-z]+):(?<num>\d+)/ | |
m = p.match(s) | |
puts m[:alpha] #=> abc | |
puts m[:num] #=> 123 | |
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 org.orbroker._ | |
import org.orbroker.config._ | |
object HelloWorld { | |
def main(args: Array[String]) { | |
val jdbcURL = args(0) | |
val config = new BrokerConfig(jdbcURL) | |
val broker = Broker(config) | |
val count = broker.readOnly() { session => |
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
/* SIP11 https://docs.google.com/document/d/1NdxNxZYodPA-c4MLr33KzwzKFkzm9iW9POexT9PkJsU/edit?hl=en_US */ | |
toshi@/home/toshi% ./opt/scala-2.10.0-M5/bin/scala | |
Welcome to Scala version 2.10.0-M5 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_32). | |
Type in expressions to have them evaluated. | |
Type :help for more information. | |
scala> val n = 10 | |
n: Int = 10 |
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 scala.collection.JavaConversions._ | |
scala> val git = new Git(new FileRepositoryBuilder().findGitDir(new java.io.File("/path/to/repos")).readEnvironment().build()) | |
git: org.eclipse.jgit.api.Git = org.eclipse.jgit.api.Git@18ed36fb | |
scala> git.log.addPath("foo").call.head | |
res49: org.eclipse.jgit.revwalk.RevCommit = commit c4554d9f46de49e449242a2aa75d39874dc99498 1342332998 ----sp | |
scala> git.log.addPath("foo").call.headOption | |
res50: Option[org.eclipse.jgit.revwalk.RevCommit] = Some(commit d3107ef998b25d70f86f1a5d530c31c02507d59e 1342012813 ----sp) |