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 RomanNumerals{ | |
class RomanNumeralsException extends Exception | |
private val rn="IVXLCDM ".toList | |
def apply(n:Int):String={ | |
type LS = List[String] | |
def n2ivx(n:Int, i:String, v:String, x:String):String = n match{ | |
case 4 => i+v |
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
/** | |
Copyright (c) 2009 ymnk, JCraft,Inc. All rights reserved. | |
Redistribution and use in source and binary forms, with or without | |
modification, are permitted provided that the following conditions are met: | |
1. Redistributions of source code must retain the above copyright notice, | |
this list of conditions and the following disclaimer. | |
2. Redistributions in binary form must reproduce the above copyright |
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.io.Source | |
/** | |
* http://www.facebook.com/jobs_puzzles/index.php?puzzle_id=7 | |
*/ | |
object HoppityHop{ | |
def main(arg:Array[String]){ | |
val line = Source.fromFile(arg(0)).getLine(1) | |
// val Array(n) = line.split(" ").filter(_.length!=0) | |
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 program is a 2D shooting game written in Scala by | |
@h_sakurai(http://twitter.com/h_sakurai), | |
and has been originally hosted at https://gist.github.com/46448 . | |
@ymnk(http://twitter.com/ymnk) has slightly modified that code | |
to run it on scala 2.8 with sbt. | |
$ sbt | |
> run |
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 swing._ | |
import swing.event._ | |
/** | |
* http://d.hatena.ne.jp/xibbar/20081203#1228294818 | |
*/ | |
object SimpleGui1B extends SimpleGUIApplication { | |
def top = new MainFrame { | |
title = "SimpleGui1B" | |
contents = new Button { |
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
/* | |
Copyright (c) 2008 ymnk, JCraft,Inc. All rights reserved. | |
Redistribution and use in source and binary forms, with or without | |
modification, are permitted provided that the following conditions are met: | |
1. Redistributions of source code must retain the above copyright notice, | |
this list of conditions and the following disclaimer. | |
2. Redistributions in binary form must reproduce the above copyright |
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
/* | |
Copyright (c) 2008 ymnk, JCraft,Inc. All rights reserved. | |
Redistribution and use in source and binary forms, with or without | |
modification, are permitted provided that the following conditions are met: | |
1. Redistributions of source code must retain the above copyright notice, | |
this list of conditions and the following disclaimer. | |
2. Redistributions in binary form must reproduce the above copyright |
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.net.{InetAddress, Socket, InetSocketAddress} | |
import java.io._ | |
import scala.collection.mutable._ | |
import scala.io.Source | |
import scala.concurrent.ops.spawn | |
/** | |
* This program expects to be comipled with ARCFour.scala[1] . | |
* [1] http://gist.github.com/28462 | |
*/ |
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 ARCFour{ | |
private var x:Int = _ | |
private var y:Int = _ | |
private val state = new Array[Int](256) | |
def decrypt(src:Array[Byte], off:Int, length:Int):Array[Byte]={ | |
encrypt(src, off, length) | |
} | |
def decrypt(src:Array[Byte], soff:Int, |
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
/* | |
* ftdop2.scala | |
* Functional Top Down Operator Precedence | |
*/ | |
package ftdop2 | |
import scala.util.matching.Regex | |
import scala.collection.mutable.HashMap | |
object main { | |
def main(argv:Array[String]) { |