Skip to content

Instantly share code, notes, and snippets.

View johanprinsloo's full-sized avatar

Johan Prinsloo johanprinsloo

View GitHub Profile
@johanprinsloo
johanprinsloo / html5 snippet 1.scala
Created January 25, 2011 19:06
lift snippet with lowercase
<lift:surround with="default" at="content">
<h2>Dynamic Simulation UI - Tree Components...</h2>
<p>
<lift:timestamp.stab>
<span><i>Generated at <b:time/></i></span>
</lift:timestamp.stab>
</p>
</lift:surround>
class timestamp {
@johanprinsloo
johanprinsloo / stmbasic.scala
Created January 14, 2011 17:21
Basic Scala STM Syntax
import scala.concurrent.stm._
val x = Ref(0) // allocate a Ref[Int]
val y = Ref.make[String]() // type-specific default
val z = x.single // Ref.View[Int]
atomic { implicit txn =>
val i = x() // read
y() = "x was " + i // write
val eq = atomic { implicit txn => // nested atomic