Skip to content

Instantly share code, notes, and snippets.

View jaceklaskowski's full-sized avatar
:octocat:
Enjoying developer life...

Jacek Laskowski jaceklaskowski

:octocat:
Enjoying developer life...
View GitHub Profile
@jaceklaskowski
jaceklaskowski / Build.scala
Last active August 29, 2015 14:02
Snippet Build.scala from sbteclipse
lazy val root = Project(
"sbteclipse",
file("."),
aggregate = Seq(sbteclipseCore, sbteclipsePlugin),
settings = commonSettings ++ Seq(
publishArtifact := false
)
)
[info] Generating pdf en/sbt-tutorial...
[error] pandoc: Duplicate link reference `[Using-Plugins]' "source" (line 2418, column 1)
[error] pandoc: Duplicate link reference `[Full-Def]' "source" (line 2417, column 1)
[error] pandoc: Duplicate link reference `[Scopes]' "source" (line 2416, column 1)
[error] pandoc: Duplicate link reference `[Basic-Def]' "source" (line 2415, column 1)
[error] pandoc: Duplicate link reference `[Using-Plugins]' "source" (line 2166, column 1)
[error] pandoc: Duplicate link reference `[More-About-Settings]' "source" (line 2165, column 1)
[error] pandoc: Duplicate link reference `[Basic-Def]' "source" (line 2164, column 1)
[error] pandoc: Duplicate link reference `[Plugins]' "source" (line 2067, column 1)
[error] pandoc: Duplicate link reference `[Input-Tasks]' "source" (line 2066, column 1)
@jaceklaskowski
jaceklaskowski / gist:93c344b5242cb2c4ba04
Last active August 29, 2015 14:06
Spark 1.2.0-SNAPSHOT + spark-cassandra-connector-assembly-1.2.0-SNAPSHOT
➜ spark git:(master) ./bin/spark-shell --master local --jars /Users/jacek/oss/spark-cassandra-connector/spark-cassandra-connector/target/scala-2.10/spark-cassandra-connector-assembly-1.2.0-SNAPSHOT.jar
Spark assembly has been built with Hive, including Datanucleus jars on classpath
Using Spark's default log4j profile: org/apache/spark/log4j-defaults.properties
14/09/23 22:13:03 INFO SecurityManager: Changing view acls to: jacek
14/09/23 22:13:03 INFO SecurityManager: Changing modify acls to: jacek
14/09/23 22:13:03 INFO SecurityManager: SecurityManager: authentication disabled; ui acls disabled; users with view permissions: Set(jacek); users with modify permissions: Set(jacek)
14/09/23 22:13:03 INFO HttpServer: Starting HTTP Server
14/09/23 22:13:03 INFO Utils: Successfully started service 'HTTP class server' on port 62525.
Welcome to
____ __
@jaceklaskowski
jaceklaskowski / build.sbt
Created October 1, 2014 09:00
rxscala 0.21.1 and Scala 2.11.2 - to get you going quickly
libraryDependencies += "io.reactivex" %% "rxscala" % "0.21.1"
scalaVersion := "2.11.2"
initialCommands in console := """
import rx.lang.scala._
"""
@jaceklaskowski
jaceklaskowski / futureObserver.scala
Last active August 29, 2015 14:07
A working with Observable.from and Future example
// from https://groups.google.com/d/msg/rxjava/GyVmw-ttbDY/qGHSO5EiEugJ
import rx.lang.scala._
import scala.concurrent._
import ExecutionContext.Implicits.global
import java.util.concurrent.TimeUnit
println(s"Current thread: ${Thread.currentThread.getName()}") // run-main-1
def timeConsumingComputation() = {
TimeUnit.SECONDS.sleep(2)
@jaceklaskowski
jaceklaskowski / about-titan-graph-database.md
Created December 11, 2014 09:48
About Titan graph database (and Gremlin, TinkerPop3 with Scala)

From http://www.tinkerpop.com/docs/3.0.0.M1/:

TinkerPop2 and below made a sharp distinction between the various TinkerPop projects: Blueprints, Pipes, Gremlin, Frames, Furnace, and Rexster. With TinkerPop3, all of these projects have been merged and are generally known as Gremlin. Blueprints → Gremlin Structure API : Pipes → GraphTraversal : Frames → Traversal : Furnace → GraphComputer and VertexProgram : Rexster → GremlinServer.

@jaceklaskowski
jaceklaskowski / Flow[HttpRequest, HttpResponse].md
Last active August 29, 2015 14:12
How Spray benefit from Flow[HttpRequest, HttpResponse], if any?

From the scaladoc for trait Flow[-In, +Out] (package akka.stream.scaladsl):

A Flow is a set of stream processing steps that has one open input and one open output.

Therefore, Flow[HttpRequest, HttpResponse] is a set of stream processing steps that has one open HttpRequest input and one open HttpResponse output.

It appears that inputs are called Sources and outputs are Sinks. Connecting a Source to a Sink creates a flow graph.

That's pretty much the good ol' Spray.

@jaceklaskowski
jaceklaskowski / sbt-launch-snapshot.md
Created January 18, 2015 17:15
How to use sbt 0.13.8-SNAPSHOT
➜  sbt-snapshot  curl -o sbt-launch-0.13.8-SNAPSHOT.jar https://repo.typesafe.com/typesafe/ivy-snapshots/org.scala-sbt/sbt-launch/0.13.8-SNAPSHOT/sbt-launch.jar
➜  sbt-snapshot  tree
.
|-- project
|   `-- build.properties
`-- sbt-launch-0.13.8-SNAPSHOT.jar

1 directory, 2 files
➜  sbt-snapshot  cat project/build.properties
@jaceklaskowski
jaceklaskowski / scala-2.11.5-busted.md
Created January 19, 2015 22:20
Scala 2.11.5 busted?

That works in 2.11.4:

scala> scala.util.Properties.versionString
res0: String = version 2.11.4

scala> val s = Seq(1 -> 2)
s: Seq[(Int, Int)] = List((1,2))

scala> s.groupBy(_._1)
@jaceklaskowski
jaceklaskowski / HelloSpec.md
Created January 28, 2015 23:08
specs2 DataTables
import org.specs2._

class HelloSpec extends Specification with matcher.DataTables { def is =
  "adding integers should just work in scala"  ! e1

  def e1 =
    "a"   | "b" | "c" |                                   // the header of the table, with `|` separated strings
     2    !  2  !  4  |                                   // an example row
 1 ! 1 ! 2 |> { // the > operator to "execute" the table