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 scala.reflect.runtime.universe._ | |
object Main extends App { | |
trait SomeTrait | |
def doSomething[T: TypeTag] = | |
typeTag[T].tpe | |
val threads = List.fill(100) { |
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
[warn] The global sbt directory is now versioned and is located at /Users/flavio/.sbt/0.13. | |
[warn] You are seeing this warning because there is global configuration in /Users/flavio/.sbt but not in /Users/flavio/.sbt/0.13. | |
[warn] The global sbt directory may be changed via the sbt.global.base system property. | |
[info] Loading project definition from /Users/flavio/workspace/Activate_benchmark/project | |
[info] Set current project to Activate_benchmark (in build file:/Users/flavio/workspace/Activate_benchmark/) | |
> run | |
[info] Compiling 1 Scala source to /Users/flavio/workspace/Activate_benchmark/target/scala-2.11/classes... | |
[info] Running activate.ActivateBenchMark | |
09:27:43.191 [run-main-0] DEBUG org.reflections.Reflections - going to scan these urls: | |
file:/Users/flavio/workspace/Activate_benchmark/target/scala-2.11/classes/ |
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 Demo { | |
// A couple of type classes with type members ... | |
trait Foo[T] { | |
type A | |
} | |
object Foo { | |
implicit val fooIS = new Foo[Int] { type A = String } | |
} |
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> class Bippy(xs: List[Int]) extends improving.TypesafeProxy(xs) { def isEmpty = true } | |
defined class Bippy | |
scala> val bippy = new Bippy(1 to 10 toList) | |
bippy: Bippy = List(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) | |
scala> bippy.slice(3, 7) | |
[proxy] $line4.$read.$iw.$iw.bippy.slice(3, 7) | |
res1: List[Int] = List(4, 5, 6, 7) |
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
t1.flatMap(a => t2.filter(b => b.s == a.s).map(b => b.s)) | |
SELECT t2.s FROM t1, t2 WHERE t2.s = t1.s | |
t1.flatMap(a => t2.map(b => b.s).take(10)) | |
SELECT x.s FROM t1, (SELECT * FROM t2 LIMIT 10) x | |
t1.flatMap(a => t2.filter(b => b.s == a.s).map(b => b.s).take(10)) |
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 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)) |
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 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")) |
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
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 { |
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.foo | |
import activateExampleContext._ | |
class Person( | |
var name: String) | |
extends Vertex | |
class Knows( | |
val from: Person, |
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.fwbrasil.sReflection | |
object CascadeImplicits { | |
implicit def toYourself[T](value: T): Yourself[T] = new Yourself(value) | |
implicit def toCascade[T](value: T): Cascade[T] = new Cascade(value) | |
class Yourself[T](value: T) { | |
def yourself = value | |
} |
OlderNewer