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.example.kvxml2 | |
import _root_.scala.xml.{Elem, MetaData, Node, NodeSeq, Null, Text, TopScope, UnprefixedAttribute} | |
sealed abstract class Value { | |
def nodes: NodeSeq | |
} | |
case class StringValue(str: String) extends Value { |
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.example.kvxml | |
import _root_.scala.xml.{Elem, MetaData, Node, NodeSeq, Null, Text, TopScope, UnprefixedAttribute} | |
sealed abstract class Value | |
case class StringValue(str: String) extends Value | |
case class ValueSeq(seq: Seq[Value]) extends Value | |
case class KeyValue(key: String, attributes: Map[String, String], value: Value) extends Value { | |
def this(key: String, value: Value) = this(key, Map.empty, value) |
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
#!/bin/sh | |
exec scala -deprecation `cygpath -m $0` "$@" | |
!# | |
object CreateProject { | |
import scala.util.control.Exception._ | |
def usage() { | |
println("create_project <name> <pkg> [--scala-version <version>] " + | |
"[--android] " + |
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 javax.media.opengl.{ GLAutoDrawable, GLProfile, GLCapabilities, GLEventListener } | |
import com.jogamp.newt.event.{ WindowAdapter, WindowEvent } | |
import com.jogamp.newt.opengl.GLWindow | |
import com.jogamp.opengl.util.FPSAnimator | |
object NewtSample { | |
def main(args : Array[String]){ | |
GLProfile.initSingleton() | |
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
class Matrix extends Function2[Int, Int, Float] { | |
import Matrix.{ width, height } | |
private val e = new Array[Float](width * height) | |
def apply(row : Int, col : Int) = e(row * width + col) | |
def update(row : Int, col : Int, value : Float) { e(row * width + col) = value } | |
def initializeWith(f : (Int, Int) => Float) = { | |
for { | |
row <- 0 until height |
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 sample; | |
import java.util.Map; | |
/** | |
* | |
*/ | |
public class GoodCodeRed<V> { | |
public <K> Map<K, V> test(K k) { |
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
$ scalac sample.scala | |
sample.scala:14: error: applyDynamic does not support passing a vararg parameter | |
new Foo().foo(xs:_*).foobar(new Bar().bar) | |
^ | |
one error found |
NewerOlder