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
class A | |
class A2 extends A | |
class B | |
trait M[X] | |
// | |
// Upper Type Bound | |
// | |
def upperTypeBound[AA <: A](x: AA): A = 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
package com.uo.liquidz.http | |
import java.net.{URL, HttpURLConnection} | |
import java.io.{BufferedReader, InputStreamReader, BufferedWriter, OutputStreamWriter, IOException} | |
// ssl | |
import java.security.{KeyManagementException, NoSuchAlgorithmException, SecureRandom} | |
import java.security.cert.{CertificateException, X509Certificate} | |
import javax.net.ssl.{HttpsURLConnection, KeyManager, SSLContext, TrustManager, X509TrustManager} | |
import Simply._ |
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
# Identifying character names in The Adventures of David Simple | |
# source: http://www.munseys.com/diskone/davidsimp.htm | |
# | |
# commands: | |
# ./ner.sh david_simple.txt > david_simple.ner.txt | |
# sed -e 's/\S\+\/[^P]\w*//g' -e 's/\s\{2,\}/\n/g' -e 's/\/PERSON//g' david_simple.ner.txt | sort | uniq -c | sort -nr | sed 's/^\s\+//' | awk '{if ($1 > 1) print $1,"\t",substr($0, length($1)+2) }' | |
# note: ner.sh is Stanford NER http://nlp.stanford.edu/software/CRF-NER.html | |
238 David | |
131 Cynthia |
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
package scalaz.example.nio | |
import scalaz._ | |
import concurrent.Promise | |
import effects.IO | |
import nio.sockets._ | |
import nio.Channels._ | |
import Scalaz._ | |
import iteratees._ | |
import java.nio.channels.SocketChannel |
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
// simple map and fold left/right implementations | |
// in scala using pattern matching for List[Int] | |
def map(list:List[Int], f:(Int) => Int):List[Int] = { | |
list match { | |
case Nil => Nil | |
case head::tail => f(head)::map(tail, f) | |
} | |
} |
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
// scala -P:continuations:enable | |
//Continuation对于诸如异步I/O,UI事件处理以及数据流并发之类的高级控制建造十分有帮助 | |
import util.continuations._ | |
object Continue{ | |
def say = | |
reset { | |
shift { | |
cf:(Int=>Int) => | |
val even = cf(10) |
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
Vagrant::Config.run do |config| | |
# ... | |
config.vm.customize ["modifyvm", :id, "--natdnshostresolver1", "on"] | |
end |
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 scala.util.parsing.json._ | |
val result = JSON.parseFull(""" | |
{"name": "Naoki", "lang": ["Java", "Scala"]} | |
""") | |
result match { | |
case Some(e) => println(e) // => Map(name -> Naoki, lang -> List(Java, Scala)) | |
case None => println("Failed.") | |
} |
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
-- This table is useful for rough statistics based on gender | |
-- Don't consider it scientific in any way. | |
-- | |
-- Example use: | |
-- select COALESCE( | |
-- (SELECT gender | |
-- FROM gender_types | |
-- WHERE name=users.first_name | |
-- LIMIT 1), | |
-- 'U') gender_type, count(*) |
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
# Credit http://stackoverflow.com/a/2514279 | |
for branch in `git branch -r | grep -v HEAD`;do echo -e `git show --format="%ci %cr" $branch | head -n 1` \\t$branch; done | sort -r |
OlderNewer