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> ??? | |
| scala.NotImplementedError: an implementation is missing | |
| at scala.Predef$.$qmark$qmark$qmark(Predef.scala:233) | |
| at .<init>(<console>:8) | |
| at .<clinit>(<console>) | |
| at .<init>(<console>:11) | |
| at .<clinit>(<console>) | |
| at $print(<console>) | |
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) | |
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) |
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_2.10.0-M1 -Xexperimental | |
| Welcome to Scala version 2.10.0-M1 (Java HotSpot(TM) Client VM, Java 1.6.0_18). | |
| Type in expressions to have them evaluated. | |
| Type :help for more information. | |
| scala> val name = "Martin" | |
| name: String = Martin | |
| scala> val intro = s"My name is $name" | |
| intro: String = My name is Martin |
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
| val uriEscaped = args(0) | |
| def unescapeHexChars(char1: Char, char2: Char): Byte = { | |
| Integer.decode("0x" + char1 + char2).toByte | |
| } | |
| def unescape(str: List[Char]): List[Byte] = { | |
| str match { | |
| case '%' :: x1 :: x2 :: xs => unescapeHexChars(x1, x2) :: unescape(xs) | |
| case x :: xs => x.toByte :: unescape(xs) |
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 += "org.jsoup" % "jsoup" % "1.6.1" | |
| import org.jsoup._ | |
| import java.io._ | |
| import java.net.URL | |
| import collection.JavaConversions._ | |
| val url = "https://picasaweb.google.com/xxx" | |
| val dir = "downloaded" |
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 tools; | |
| import static org.mockito.Matchers.*; | |
| /** | |
| * Problem: cannot compile the following code | |
| * | |
| * <pre> | |
| * import static org.hamcrest.Matchers.*; | |
| * import static org.mockito.Matchers.*; |
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
| @Grab('commons-codec:commons-codec:1.2') | |
| import org.apache.commons.codec.net.URLCodec; | |
| def input = URLDecoder.decode("http://www.google.co.jp/?q=URLEncoder%E3%81%AF%E3%81%A9%E3%82%8C%E3%81%8F%E3%82%89%E3%81%84%E9%81%85%E3%81%84%E3%81%AE%E3%81%8B%E3%80%81commons-codec%E3%81%A8%E6%AF%94%E8%BC%83%E3%81%97%E3%81%A6%E3%81%BF%E3%81%BE%E3%81%99", "UTF-8") | |
| int times = 1000000; | |
| class Stopwatch { | |
| Integer startTime = null | |
| Integer endTime = null |
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
| organization := "net.seratch" | |
| name := "sandbox" | |
| version := "0.1" | |
| scalaVersion := "2.9.1" | |
| libraryDependencies ++= Seq( | |
| "junit" % "junit" % "4.9" withSources(), |
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
| // #nodejyuku | |
| var connect = require("connect"); | |
| // my first middleware | |
| var requestDumper = function() { | |
| return function(req, res, next) { | |
| console.log(req); | |
| next(); | |
| }; |
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/sh -x | |
| # --- KeyczarTool Script --- | |
| # @see http://code.google.com/p/keyczar/wiki/KeyczarTool | |
| wget http://keyczar.googlecode.com/files/KeyczarTool.jar | |
| java -jar ./KeyczarTool.jar create --location=. --purpose=crypt --name="$1" | |
| java -jar ./KeyczarTool.jar addkey --location=. --status=primary | |
| ls # 1 meta |
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
| @GrabResolver(name='seratch_github_com_releases', root='http://seratch.github.com/mvn-repo/releases', m2Compatible='true') | |
| @Grab('com.github.seratch:httpilot:0.1') | |
| import httpilot.*; | |
| import java.util.*; | |
| formParams = new HashMap<String, Object>(); | |
| formParams.put("user", "seratch"); | |
| formParams.put("repo", "scalikesolr"); | |
| formParams.put("version", "3.5.0"); | |
| req = new Request("http://ls.implicit.ly/api/1/libraries"); |