This file contains hidden or 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
val input = (Stream.continually(Promise[Unit]) zip Range.inclusive(1, 5)).toList | |
implicit val materializer = ActorMaterializer() | |
val source = AckedSource(input) | |
val Seq(s1, s2) = (1 to 2) map { n => AckedSink.fold[Int, Int](0)(_ + _) } | |
val g = AckedFlowGraph.closed(s1, s2)((m1, m2) => (m1, m2)) { implicit b => | |
(s1, s2) => |
This file contains hidden or 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
// RabbitSource in op-rabbit v1.0.0-M9 returns an AckedSource | |
val source = RabbitSource( | |
"Worker", | |
rabbitMq, | |
channel(qos = 100), | |
consume(topic("app.domain.class", topics = List(Pg.Table("MainTable").all, Pg.Table("RelatedTable").all))), | |
body(as[PgChange]).map(getPrimaryId)) | |
source. | |
collect { case Some(i) => i }. |
This file contains hidden or 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
val source = Source(RabbitSource( | |
"Worker", | |
rabbitMq, | |
channel(qos = 100), | |
consume(topic("app.domain.class", topics = List(Pg.Table("MainTable").all, Pg.Table("RelatedTable").all))), | |
body(as[PgChange]).map(getPrimaryId))) | |
source. | |
map { case (p, primaryId) => Delivery(p, primaryId) }. | |
mapConcat { delivery => |
This file contains hidden or 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 m | |
import akka.actor.{ ActorSystem, Props, ActorRef } | |
import akka.stream.FlowMaterializer | |
import akka.stream.actor.{RequestStrategy, ActorPublisherMessage, ActorSubscriberMessage, ActorSubscriber, MaxInFlightRequestStrategy, ActorPublisher } | |
import akka.stream.scaladsl.{ Sink, Source } | |
import akka.stream.stage._ | |
import scala.annotation.tailrec | |
import scala.collection.mutable.Queue | |
import scala.util.{Failure, Success} |
This file contains hidden or 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
(require 'company) | |
(global-company-mode t) | |
(global-set-key (kbd "s-;") 'company-dabbrev) | |
(global-set-key (kbd "s-:") 'company-complete) | |
(global-auto-complete-mode 0) ;; disable this!!! they fight eachother and it is annoying. |
This file contains hidden or 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
(defun forward-evil-word (&optional count) | |
"" | |
(let ((init-point (point))) | |
(forward-symbol (or count 1)) | |
(if (= (point) init-point) | |
count 0))) | |
(setq evil-symbol-word-search t) |
This file contains hidden or 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 main | |
import akka.actor.{Actor,ActorSystem, Props} | |
import akka.stream.scaladsl.Source | |
import akka.stream.FlowMaterializer | |
import scala.concurrent.Future | |
import scala.util.{Try,Success,Failure} | |
// import scala.Predef.identity | |
object Counter { |
This file contains hidden or 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 main | |
import akka.stream.{ FlowMaterializer, MaterializerSettings } | |
import akka.stream.scaladsl.{Source,ForeachSink,FlowGraph,FlowGraphImplicits} | |
import akka.actor.ActorSystem | |
import scala.concurrent.{Await, ExecutionContext, Future} | |
import scala.concurrent.duration._ | |
import scala.util.Try | |
object Main extends App { |
This file contains hidden or 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 shapeless._ | |
import scala.concurrent._ | |
import scala.concurrent.ExecutionContext.Implicits.global | |
object FutureReducer extends Poly2 { | |
implicit def f[A, B <: HList] = at[Future[A], Future[B]] { (f, resultFuture) => | |
resultFuture flatMap { r => | |
f map { v => | |
v :: r | |
} |
This file contains hidden or 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
#!/bin/sh | |
exec scala "$0" "$@" | |
!# | |
object Factor extends Enumeration { | |
val Econ = Value("Econ") | |
val Stock = Value("Stock") | |
} | |
import Factor._ |