Skip to content

Instantly share code, notes, and snippets.

View SethTisue's full-sized avatar

Seth Tisue SethTisue

View GitHub Profile
@SethTisue
SethTisue / gist:1006793
Created June 3, 2011 17:56
Paul Phillips' magic formula for fast REPL startup
Last login: Fri Jun 3 10:53:41 on ttys008
~ % scala/dists/latest/bin/scala -J-client -J-d32 -Dscala.repl.power
Welcome to Scala version 2.10.0.r25048-b20110531064458 (Java HotSpot(TM) Client VM, Java 1.6.0_24).
Type in expressions to have them evaluated.
Type :help for more information.
[info] started at Fri Jun 03 10:56:24 PDT 2011
[info] compiler init time: 1.988 s.
** Power User mode enabled - BEEP BOOP WHIR **
Last login: Fri Jun 3 10:17:44 on ttys003
~ % scala29
Welcome to Scala version 2.9.0.1 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_24).
Type in expressions to have them evaluated.
Type :help for more information.
scala> :q
scala29 -Dr
~ % scala29 -Dscala.repl.power=true (master⚡)
Welcome to Scala version 2.9.0.1 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_24).
Last login: Fri Jun 3 10:39:02 on ttys004
~ % scala29
Welcome to Scala version 2.9.0.1 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_24).
Type in expressions to have them evaluated.
Type :help for more information.
scala> :implicits
No implicits have been imported other than those in Predef.
scala> :imports
Last login: Fri Jun 3 10:39:54 on ttys004
~ % cd scala
META-INF/ build.examples.xml dists/ project/
README build.number docs/ src/
build/ build.xml gitignore.SAMPLE test/
build.detach.xml classpath.SAMPLE lib/ tools/
~/scala % dists/latest/bin/scala (master↑16⚡)
Welcome to Scala version 2.10.0.r25048-b20110531064458 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_24).
Type in expressions to have them evaluated.
Type :help for more information.
@SethTisue
SethTisue / .ensime
Created August 2, 2011 15:47
ENSIME project file for use with the sbt 0.10 sources
(
:project-package "sbt"
:use-sbt t
:sources ("cache" "compile" "interface" "ivy" "launch" "main" "util" "tasks" "testing" "scripted")
)
@SethTisue
SethTisue / gist:1217097
Created September 14, 2011 16:59
Telling sbt 0.7 where to get a jar
// from a particular repo
object Repos {
val jmfRepo = "java.net" at "http://download.java.net/maven/2"
}
val jmfConfig = ModuleConfiguration("javax.media", Repos.jmfRepo)
val jmf = "javax.media" % "jmf" % "2.1.1e"
// from a URL that doesn't even have to be an actual repo
val jhotdraw = "org.jhotdraw" % "jhotdraw" % "6.0b1" from
"http://ccl.northwestern.edu/devel/jhotdraw-6.0b1.jar"
@SethTisue
SethTisue / gist:1236139
Created September 22, 2011 21:43
serialization example (typeclass pattern)
case class Person(name: String, age: Int)
case class Restaurant(name: String, servesBrunch: Boolean)
trait Serializable[T] {
def ser(t: T): String
}
def serialize[T](t: T)(implicit s: Serializable[T]) =
s.ser(t)
implicit object PersonIsSerializable
@SethTisue
SethTisue / gist:1878299
Created February 21, 2012 19:22
two NetLogo InterfaceComponents in one frame
import javax.swing.JFrame
import java.awt.FlowLayout
import org.nlogo.lite.InterfaceComponent
object Test extends App {
val path = "/Applications/NetLogo 5.0/models/Sample Models/"
java.awt.EventQueue.invokeAndWait(
new Runnable {
override def run() {
val frame = new JFrame
@SethTisue
SethTisue / interpreter.scala
Created March 10, 2012 15:51 — forked from chrislewis/interpreter.scala
quick interpreter for nescala
package necsala.embedded
import scala.tools.nsc.interpreter.AbstractFileClassLoader
import scala.tools.nsc.{Global, Settings}
import scala.tools.nsc.util.BatchSourceFile
import scala.tools.nsc.io.{AbstractFile, VirtualDirectory}
import java.io.File
import java.util.jar.JarFile
import java.net.URLClassLoader