Skip to content

Instantly share code, notes, and snippets.

View fwbrasil's full-sized avatar

Flavio Brasil fwbrasil

  • Nubank
  • San Francisco Bay Area, California
View GitHub Profile
@fwbrasil
fwbrasil / gist:3783157
Created September 25, 2012 17:02
Subtrate rest
trait Person extends Entity {
var name: String
def nameAsUpperCase =
name.toUpperCase
}
object Person {
def personsWhereNameStartsWith(string: String) =
select[Person] where (_.name like string + "%")
}
class NaturalPerson(var name: String, var motherName: String) extends Person {
@fwbrasil
fwbrasil / Nolan.scala
Created September 4, 2012 12:23
Nolan test...
package nolan
import net.fwbrasil.activate.ActivateContext
import net.fwbrasil.activate.migration.Migration
import net.fwbrasil.activate.storage.mongo.MongoStorage
object MongoContext extends ActivateContext {
def contextName = "mongoContext"
val storage = new MongoStorage {
override val authentication = Option(("activate_test", "activate_test"))
@fwbrasil
fwbrasil / PrevaylerJr.scala
Created April 6, 2012 20:01
PrevaylerJr in Scala
import java.io._
class PrevaylerJr[T <: Serializable](initialState: T, pStorageFile: File) {
private val storageFile = new File(pStorageFile.getAbsolutePath + ".tmp")
private val system = {
val fileToRead = if (pStorageFile.exists) pStorageFile else storageFile
if (fileToRead.exists) {
val input = new ObjectInputStream(new FileInputStream(fileToRead))