Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

afz aamir-f

🎯
Focusing
  • zettalabs
  • Bangalore,India
Block or report user

Report or block aamir-f

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View customEventBusExample.scala
import akka.actor._
import akka.event.{LookupClassification, EventBus}
import akka.event.ActorEventBus
case class Book(title: String, authors: List[String])
class AuthorBookBus(author: String) extends EventBus
with LookupClassification
with ActorEventBus {
View eventStreamExample.scala
import akka.actor._
case class Book(title: String, authors: List[String])
class BookPublisher extends Actor {
def receive = {
case book: Book => {
println(s"Yeah! Publishing a new book: $book")
context.system.eventStream.publish(book)
@aamir-f
aamir-f / GenericsStart
Created Mar 21, 2017
Simple Generic Start In Scala
View GenericsStart
package generics
object TestProb1 extends App {
//type constraints
class D[T <: B] // T must be a B. i.e. for any T, it is a B or a subclass of B.
new D[B]()
new D[C]()
//new D[A]() CTE (type arguments [generics.A] do not conform to class D's type parameter bounds [T <: generics.B]
View alternative, using regex
val pattern = java.util.regex.Pattern.compile ("""(?xs) ("(.*?)"|) ; ("(.*?)"|) (?: \r?\n | \z ) """)
val matcher = pattern.matcher (input)
while (matcher.find) {
val col1 = matcher.group (2)
val col2 = matcher.group (4)
// ...
}
You can’t perform that action at this time.