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
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
#!/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
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
package net.liftweb.mongodb.record.field | |
import _root_.net.liftweb.common.{Failure, Empty, Box, Full} | |
import _root_.net.liftweb.json.JsonAST.{JValue, JObject, JField, JNothing, JNull} | |
import _root_.net.liftweb.json.JsonParser | |
import _root_.net.liftweb.record.{Field, MandatoryTypedField, FieldHelpers} | |
import _root_.net.liftweb.mongodb.record.MongoRecord | |
import _root_.net.liftweb.util.Helpers.tryo | |
import _root_.com.mongodb.{BasicDBObject, DBObject} |
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.hellojocl | |
import java.nio.FloatBuffer | |
import util.Random | |
import com.jogamp.opencl.{CLBuffer, CLContext} | |
class HelloJOCL(ctx: CLContext) { | |
import HelloJOCL._ |
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> trait DateOrdering extends scala.math.Ordering[java.util.Date] { | |
| def compare(x: java.util.Date, y: java.util.Date) = x.compareTo(y) | |
| } | |
defined trait DateOrdering | |
scala> implicit object Date extends DateOrdering | |
defined module Date | |
scala> List(new java.util.Date()).min | |
res6: java.util.Date = Fri Apr 15 15:16:18 JST 2011 |
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.plugin.google | |
import com.intellij.openapi.actionSystem.{PlatformDataKeys, AnAction, AnActionEvent} | |
import com.intellij.ide.BrowserUtil | |
import java.io.UnsupportedEncodingException | |
import java.net.URLEncoder | |
import scala.util.control.Exception._ | |
class GoogleSearchAction extends AnAction { |
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 Sample extends App { | |
val seq = Seq(1, 2, 3) | |
val empty = Seq[Int]() | |
println(seq.max) // -> 3 | |
// println(empty.max) // -> java.lang.UnsupportedOperationException: empty.max | |
import scalaz._, Scalaz._ |
OlderNewer