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
Show hidden characters
| { | |
| "cmd": ["xsbt compile"], | |
| "file_regex": "^\\[error\\] ([.a-zA-Z0-9/-]+[.]scala):([0-9]+):", | |
| "selector": "source.scala", | |
| "working_dir": "${project_path:${folder}}", | |
| "shell": "true", | |
| "encoding": "GBK" | |
| } | |
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
| Runtime.getRuntime.addShutdownHook(new Thread{ override def run = println("exit!!!") }) |
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> def a[T](i:T)(implicit ev: =:=[String, T]) = println(i) | |
| a: [T](i: T)(implicit ev: =:=[String,T])Unit | |
| scala> def test[T <: Any](a : T)(implicit ev : T =:= String) = println(a) | |
| test: [T](a: T)(implicit ev: =:=[T,String])Unit | |
| scala> test("aa") | |
| aa | |
| scala> test(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
| scala> def a(x: Int) = {println("evaluated"); x * 100 } | |
| a: (x: Int)Int | |
| scala> val s : Stream[Int] = 1 #:: 2 #:: 3 #:: a(100) #:: Stream.empty | |
| s: Stream[Int] = Stream(1, ?) | |
| scala> s(0) | |
| res0: Int = 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
| List(("a",1),("b",2)).map(case (x,y) => x + y) | |
| List(("a",1),("b",2)).map{case (x,y) => x + y} | |
| val func0: (Int, Int)=>Int = case (x, y) | |
| val func1: (Int, Int)=>Int = { case (x, y) => x + y } | |
| func1(1, 2) | |
| func1(1->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
| object ParBenchmark { | |
| case class Result(item: Int, c: Long, p: Long) { | |
| override def toString = "%-10s\t%-10d\t%-10d".format(item, c, p) | |
| } | |
| def time(proc: => Any) = { | |
| def curr = System.currentTimeMillis | |
| val s = curr; proc; curr - s | |
| } | |
| def even(i: Int) = i % 2 == 0 |
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
| package demo | |
| import blueeyes.BlueEyesServer | |
| import blueeyes.BlueEyesServiceBuilder | |
| import blueeyes.concurrent.Future | |
| import blueeyes.concurrent.Future._ | |
| import blueeyes.core.data.{ ByteChunk, BijectionsChunkJson } | |
| import blueeyes.core.http.HttpStatusCodes._ | |
| import blueeyes.core.http.combinators.HttpRequestCombinators | |
| import blueeyes.core.http.MimeTypes._ |
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 --posix | |
| ## modified from Scala shell | |
| # | |
| ############################################################################## | |
| # Copyright 2002-2011, LAMP/EPFL | |
| # | |
| # This is free software; see the distribution for copying conditions. | |
| # There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A | |
| # PARTICULAR PURPOSE. | |
| ############################################################################## |
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
| package test; | |
| import java.io.BufferedReader; | |
| import java.io.FileReader; | |
| import java.io.IOException; | |
| import java.util.concurrent.Callable; | |
| import api.Unchecked; | |
| public class Test { |
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
| package test | |
| import com.codahale.jerkson.Json._ | |
| import scala.reflect.BeanInfo | |
| import scala.reflect.BeanProperty | |
| object TestJerkson extends App { | |
| def p(t: Any) = println(generate(t)) | |
| implicit def pw(t: Any) = new { | |
| def output_json = p(t) | |
| } |
OlderNewer