Scala公式ページの論文一覧のページのhtmlをパースして、自動でpdfのファイルっぽいものを全部ダウンロードするだけのものです
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
import language.experimental.macros | |
import language.implicitConversions | |
import scala.reflect.macros.Context | |
import scala.reflect.runtime.universe.Tree | |
class ReflectiveClosure[A, B](val tree: Tree, fn: Function1[A, B]) extends Function1[A, B] { | |
def apply(x: A) = fn(x) | |
} | |
object ReflectiveClosure { |
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 controllers | |
import lib._ | |
import play.api.mvc._ | |
import play.api.libs.json._ | |
object Auth extends Controller { | |
val GITHUB = new OAuth2[GithubUser](OAuth2Settings( |
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
## Note: the system property `sbt.global.base` was introduced in 0.10.1 | |
## sbt-0.10.0 still uses the default global directory in ~/.sbt | |
gseitz@QBallz ~/.sbt % find . -name '*target*' -prune -o -print | |
. | |
./0.10.1 | |
./0.10.1/plugins | |
./0.10.1/plugins/build.sbt | |
./0.10.1/plugins/project |
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 assetproviders { | |
import play.api.mvc.Action | |
import play.api.mvc.Controller | |
import play.api.mvc.AnyContent | |
import play.api.mvc.Call | |
/** | |
* This simple interface is meant to mimic the existing interface in Play 2.0 | |
* for the Assets controller it provides. By implementing this it is possible | |
* to mix and combine various AssetProviders to create a custom Asset controller |
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
Welcome to Scala version 2.9.1.final (Java HotSpot(TM) 64-Bit Server VM, Java 1. | |
7.0_03). | |
Type in expressions to have them evaluated. | |
Type :help for more information. | |
scala> import scala.collection.immutable.StringLike | |
import scala.collection.immutable.StringLike | |
scala> "a".format(_) | |
res0: Any* => String = <function1> |
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 hexToStr(s:String):String = { | |
s.grouped(2).map{xx => Integer.parseInt(xx, 16).toChar}.mkString("") | |
} | |
val target = 'a' to 'z' mkString | |
val hexTarget = target map {"%02x" format _.toInt} mkString | |
assert(target == hexToStr(hexTarget)) |
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 eith[R](arg: Either[Throwable, R] ) : R = { | |
/* Right(o:Either[Throwable, R]) パターンは | |
* erasureのせいで警告が出る点に注意 */ | |
arg match { | |
case Left(e) => throw e | |
case Right(o:Either[Throwable, R]) => eith(o) | |
case Right(o:R) => o | |
} | |
} | |
println(eith(Right(1))) |