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> def fo() = { | |
| var i=0 | |
| var s="init" | |
| () => { | |
| if (s == "init") { | |
| s = "add" | |
| i | |
| } else { | |
| i += 1 | |
| i |
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
export SBT_OPTS='-Xms512m -Xmx1024m -Xss1M -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=1024m' |
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 java.awt.image.{BufferedImage => BI} | |
import java.io.File | |
import javax.imageio.ImageIO | |
object avhash extends App { | |
val (w, h) = (16, 16) | |
def toHash(originFile: File) = { | |
def toGray(originFile: File) = { | |
val newImage = new BI(w, h, BI.TYPE_BYTE_GRAY) | |
val g = newImage.createGraphics() |
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 scalax.file.Path | |
import scalax.file.PathSet | |
object FilesRead { | |
def main(args: Array[String]): Unit = { | |
val fr = new FilesRead | |
fr.readdir | |
} | |
} | |
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" | |
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | |
<head> | |
<!-- | |
@xuweiさんの | |
https://github.com/xuwei-k/xuwei-k.github.com/blob/master/g8.html | |
をベースに無限スクロールするようにしてみました。 |
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
trait 使って ソース分けてみた。 | |
汎用的な def の処理を trait にしておいて | |
必要時に with で取り込んで実行する | |
object hoge1 { | |
def main(arg: Array[String]) { | |
println("へロー") | |
} | |
} |
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 java.io._ | |
case class Args( | |
filename: String | |
) | |
object Main { | |
def main(args: Array[String]) { | |
val argsOption = parseArgs(args.toList) | |
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.github.takuya71 | |
import java.io._ | |
object Loanp { | |
def main(args: Array[String]) { | |
writeFile(new File("test.txt")){writer => | |
{ | |
//write start | |
writer.println("line: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
// JSON use std lib. | |
// StackOverflowで見つけた 標準のライブラリで JSON 扱う サンプル | |
// how-to-parse-json-in-scala-using-standard-scala-classes | |
// http://stackoverflow.com/questions/4170949/ | |
import scala.util.parsing.json._ | |
// jsonデータサンプル | |
val jsonString = """{"languages":[{"name":"japanese","is_active":true,"completeness": 1.0,"books":{"title":"title1","author":"neko"}},{"name":"english","is_active":true,"completeness": 2.0,"books":{"title":"title2","author":"Dog"}}]}""" |
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
/tunes.txt |