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 TMP extends App { | |
import scala.concurrent.{Future, Await} | |
import scala.concurrent.ExecutionContext.Implicits.global | |
import scala.concurrent.duration._ | |
def b1 = { | |
val f: Future[Int] = scala.concurrent.future { 100 } | |
val r = Await.result(f, 1.second) | |
println(":> " + r) | |
} |
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 twitter { | |
import play.api.libs.ws._ | |
import play.api.libs.iteratee._ | |
import play.api.libs.oauth._ | |
import scala.concurrent.ExecutionContext.Implicits.global | |
val key = ConsumerKey("XXXX", "XXXX") | |
val twitter = OAuth(ServiceInfo( | |
"https://api.twitter.com/oauth/request_token", |
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 play.api.libs.ws._ | |
import play.api.libs.iteratee._ | |
import scala.concurrent.ExecutionContext.Implicits.global | |
WS.url("http://www.bbc.co.uk").get( resp => Iteratee.fold(0) { (i:Int, el:Array[Byte] ) => println(el); i + 1} ) |
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
PROMPT='%{$fg_bold[green]%}➜ %{$fg_bold[green]%}%p %{$fg[green]%}%c %{$fg_bold[green]%}$(git_prompt_info)%{$fg_bold[green]%} % %{$reset_color%}' | |
ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[green]%}" | |
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" | |
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[green]%}) %{$fg[green]%}✗%{$reset_color%}" | |
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[green]%})" |
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
<html> | |
<head></head> | |
<body> | |
<script> | |
var A = {who: "A"}; | |
A.sine = function(x) { return Math.sin(x); } | |
A.cube = function(x) { return x*x*x; } | |
A.compose = function(f, g) { | |
return function(x) { return f(g(x)); } |
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
var http = require('http') | |
var respond = function(res, s) { | |
res.writeHead(200); | |
res.write(s); | |
res.end(); | |
} | |
var makeService = function(resources) { |
NewerOlder