Skip to content

Instantly share code, notes, and snippets.

View axel22's full-sized avatar

Aleksandar Prokopec axel22

View GitHub Profile
import org.scalameter.api._
object MyRangeTest extends PerformanceTest.Regression {
override def reporter: Reporter = Reporter.Composite(
new RegressionReporter(
RegressionReporter.Tester.Accepter(),
RegressionReporter.Historian.Complete()),
HtmlReporter(embedDsv = true)
)
@axel22
axel22 / gist:7300277
Created November 4, 2013 09:39
Example of specialized HMap, where equality and array instantiation is factored out into a typeclass.
import scala.reflect.ClassTag
class HMap[@specialized(Int, Long) K, V](
implicit val emptyKey: HMap.Empty[K],
implicit val emptyVal: HMap.Empty[V]
object Generators {
/** Given as an example of how to combine 2 generators. */
val pairs: Generator[(Int, Int)] = for {
x <- integers
y <- integers
import org.scala.optimized.test.par.ParImmutableTreeSetSnippets
object snippets extends ParImmutableTreeSetSnippets
import scala.collection.par._
implicit val s = new workstealing.Scheduler.ForkJoin(new workstealing.Scheduler.Config.Default(8))
snippets.aggregateParallel(collection.immutable.TreeSet((0 until 30000).map(_.toString): _*))

As compiled by Kevin Wright a.k.a @thecoda

(executive producer of the movie, and I didn't even know it... clever huh?)

please, please, please - If you know of any slides/code/whatever not on here, then ping me on twitter or comment this Gist!

This gist will be updated as and when I find new information. So it's probably best not to fork it, or you'll miss the updates!

Monday June 16th

val publishCreds: Seq[Setting[_]] = Seq(userPass match {
case Some((user, pass)) =>
credentials += Credentials("Sonatype Nexus Repository Manager", "oss.sonatype.org", user, pass)
case None =>
val errorMessage =
"Publishing to Sonatype is disabled since the \"" +
publishUser + "\" and/or \"" + publishPass + "\" environment variables are not set."
publish <<= streams.map(_.log.info(errorMessage))
import sbt._
import Keys._
import Process._
import java.io.File
object ReactiveCollectionsBuild extends Build {
val publishUser = "SONATYPE_USER"
@axel22
axel22 / publication.scala
Last active August 29, 2015 14:11
Snippets showing several publication examples.
import scala.collection._
import scala.concurrent._
import ExecutionContext.global
object Ex1 {
var x: List[Int] = null
def foo() {
val buffer = mutable.ListBuffer[Int]()
buffer ++= (0 until 100)
import scala.language.experimental.macros
object Input {
//val universe: scala.reflect.runtime.universe.type = scala.reflect.runtime.universe
//import universe._
import scala.reflect.macros.whitebox.Context
type Query[T] = () => Option[T]
@axel22
axel22 / program.md
Created September 13, 2016 09:34 — forked from lrytz/program.md

9.00 Day Two Welcome

Auditorium

9.30 Tuesday Keynote

Josh Suereth, Dick Wall, Auditorium

Josh and Dick will take a deep dive into one of Scala's more advanced language constructs: the for expression. In this coding-example-heavy talk we will cover topics like:

  • For, it's not about looping