Skip to content

Instantly share code, notes, and snippets.

View asethia's full-sized avatar

Arun Sethia asethia

  • United States
View GitHub Profile
@asethia
asethia / ZAlgorithm.scala
Last active June 15, 2018 16:42
ZAlgorithm for String pattern search
package searchpattern
import scala.annotation.tailrec
/**
* ZIndex String Pattern Search
* inspired from https://www.youtube.com/watch?v=CpZh4eF8QBw
* Created by Arun Sethia on 6/6/18.
*/
@asethia
asethia / LinkedList.scala
Last active June 15, 2018 20:20
Linked List Using Scala
package linkedlist
sealed trait AbstractCons[+A] {
def value: A
def next: AbstractCons[A]
}
/**
@asethia
asethia / RestSourceStream.scala
Created May 24, 2018 02:31
This example shows how we can expose REST Akka Http end point using Source Streaming
import akka.NotUsed
import akka.http.scaladsl.common.{EntityStreamingSupport, JsonEntityStreamingSupport}
import akka.http.scaladsl.marshallers.sprayjson.SprayJsonSupport
import akka.http.scaladsl.model.headers.Accept
import akka.http.scaladsl.model.{MediaRange, MediaTypes}
import akka.http.scaladsl.server.{Directives, Route}
import akka.http.scaladsl.testkit.ScalatestRouteTest
import akka.stream.scaladsl.Source
import org.scalatest.{Matchers, WordSpec, WordSpecLike}
import spray.json.DefaultJsonProtocol