Skip to content

Instantly share code, notes, and snippets.

package play.jsonext
import play.api.libs.json.{Reads, JsPath}
import play.api.libs.functional.syntax._
object ReadsBuilder {
type Id[A] = A
def nullable(key1: String): ReadsBuilder1[Option] =
new ReadsBuilder1(key1, true)
import java.io.File
trait FileNameIsHogeHoge { self: File =>
override def getPath: String = "hogehoge"
}
class MyFile(name: String) extends File(name) with FileNameIsHogeHoge
object Main extends App{
val f = new MyFile("/tmp/file.txt")
Welcome to Scala version 2.10.4 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_55).
Type in expressions to have them evaluated.
Type :help for more information.
scala> import scala.concurrent._
import scala.concurrent._
scala> import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.ExecutionContext.Implicits.global
@xuwei-k
xuwei-k / gist:11132029
Created April 21, 2014 04:12
Set 遅い
Welcome to Scala version 2.10.4 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_55).
Type in expressions to have them evaluated.
Type :help for more information.
scala> def time[A](f: => A){ System.gc; val s = System.nanoTime; f ; println((System.nanoTime - s) / 1000000.0) }
time: [A](f: => A)Unit
scala> val list = (1 to 1000000).toList
list: List[Int] = List(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154,
@xuwei-k
xuwei-k / compile-time.md
Last active August 29, 2015 14:00
Scala 2.10.4 vs 2.11.0 compile time

scalaz-core

     |  1   |  2   |  3   |  4   |  5   |  6   |  7   | average | max | min | median |

---------|------|------|------|------|------|------|------|---------|-----|-----|--------| 2.10.4 | 183 | 163 | 146 | 146 | 160 | 159 | 158 | 159 | 183 | 146 | 159 | 2.11.0 | 132 | 146 | 148 | 151 | 161 | 161 | 167 | 152 | 167 | 132 | 151 |

specs2-common

     |  1   |  2   |  3   |  4   |  5   |  6   |  7   | average | max | min | median |

---------|------|------|------|------|------|------|------|---------|-----|-----|--------|

diff --git a/src/main/scala/scalaj/http/Http.scala b/src/main/scala/scalaj/http/Http.scala
index 6be795b..5823842 100644
--- a/src/main/scala/scalaj/http/Http.scala
+++ b/src/main/scala/scalaj/http/Http.scala
@@ -1,8 +1,8 @@
-package scalaj.http
+package httpz
+package native
-import java.lang.reflect.Field
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x0000000100ea4a20, pid=6704, tid=55847
#
# JRE version: Java(TM) SE Runtime Environment (7.0_51-b13) (build 1.7.0_51-b13)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (24.51-b03 mixed mode bsd-amd64 compressed oops)
# Problematic frame:
# C [libjava.dylib+0x9a20] JNU_NewStringPlatform+0x1c8
#
@xuwei-k
xuwei-k / List.java
Created May 5, 2014 11:16
Java8 List
package eight;
import java.util.Iterator;
import java.util.Optional;
import java.util.function.*;
public abstract class List<A> implements java.lang.Iterable<A>{
private List(){}
protected abstract A unsafeHead();
case class B()
trait A {
implicit val b = B()
}
object App extends A {
def main(args: Array[String]): Unit = {
printImplicit
}
package playjsonmacro
import play.api.libs.json._
import play.api.libs.json.Json
import scala.reflect.macros.blackbox.Context
import language.experimental.macros
object PlayJsonMacro {
def apply(jsonSource: String): JsValue = macro applyImpl