This file contains 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 cats._ | |
import doobie._ | |
import doobie.implicits._ | |
import liquibase.Liquibase | |
import liquibase.database.DatabaseFactory | |
import liquibase.database.jvm.JdbcConnection | |
import liquibase.resource.ClassLoaderResourceAccessor | |
object LiquibaseMigration { | |
def run[F[_]: Monad](xa: Transactor[F]): F[Unit] = |
This file contains 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 cats._ | |
import cats.data._ | |
import cats.effect._ | |
import cats.syntax.all._ | |
import doobie._ | |
import doobie.syntax.stream._ | |
import fs2._ | |
object Streaming { | |
This file contains 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
<?xml version='1.0' encoding='UTF-8'?> | |
<?p2f version='1.0.0'?> | |
<p2f version='1.0.0'> | |
<ius size='11'> | |
<iu id='org.aspectj.feature.group' name='AspectJ Compiler' version='1.9.0.201803261956'> | |
<repositories size='1'> | |
<repository location='http://download.eclipse.org/tools/ajdt/47_aj9/dev/update'/> | |
</repositories> | |
</iu> | |
<iu id='org.eclipse.ajdt.feature.group' name='AspectJ Development Tools' version='2.2.4.201803261956'> |
This file contains 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
java.lang.InternalError: Malformed class name | |
at java.lang.Class.getSimpleName(Class.java:1330) | |
at java.lang.Class.getCanonicalName(Class.java:1399) | |
at sbt.internal.inc.ClassToAPI$.classCanonicalName(ClassToAPI.scala:71) | |
at sbt.internal.inc.ClassToAPI$.reference(ClassToAPI.scala:324) | |
at sbt.internal.inc.ClassToAPI$.reference(ClassToAPI.scala:350) | |
at sbt.internal.inc.ClassToAPI$.$anonfun$referenceP$1(ClassToAPI.scala:340) | |
at sbt.internal.inc.ClassToAPI$.arrayMap(ClassToAPI.scala:43) | |
at sbt.internal.inc.ClassToAPI$.referenceP(ClassToAPI.scala:340) | |
at sbt.internal.inc.ClassToAPI$.reference(ClassToAPI.scala:348) |
This file contains 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 pl.caltha.commons; | |
import java.util.Collections; | |
import java.util.Iterator; | |
import java.util.LinkedList; | |
import java.util.List; | |
import java.util.NoSuchElementException; | |
import java.util.Optional; | |
import java.util.function.BiFunction; | |
import java.util.function.BinaryOperator; |
This file contains 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 akka.stream._ | |
import akka.stream.stage._ | |
/** | |
* Fan-out the stream of `scala.util.Either[L, R]` elements to `L` and `R` streams. | |
* | |
* '''Emits when''' emits when an element is available from the input and the chosen output has demand | |
* | |
* '''Backpressures when''' the currently chosen output back-pressures | |
* |
This file contains 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 akka.stream._ | |
import akka.stream.stage._ | |
/** | |
* A simple fan-out stage that will split incoming stream according to the results of a decider function. | |
* Outgoing streams may carry elements of different types. | |
* | |
* '''Emits when''' emits when an element is available from the input and both downstreams have demand | |
* | |
* '''Backpressures when''' any of the downstreams back-pressures |
This file contains 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 scala.util.Random | |
object S99_P23 { | |
def removeAt[T](n: Int, ts: Seq[T]) = (ts.take(n) ++ ts.drop(n + 1), ts(n)) | |
def randomSelect[T](count: Int, ts: Seq[T]): Seq[T] = { | |
val r = new Random | |
def go(count: Int, ts: Seq[T], acc: Seq[T]): Seq[T] = { | |
if (count > 0) { | |
val (next, elem) = removeAt(r.nextInt(ts.length), ts) |
This file contains 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 scala.annotation.tailrec | |
object S99_P17 { | |
def split_1l[T](n: Int, ts: Seq[T]) = ts.splitAt(n) | |
def split_tr[T](n: Int, ts: Seq[T]): (Seq[T], Seq[T]) = { | |
@tailrec | |
def go(n: Int, lists: (Seq[T], Seq[T])): (Seq[T], Seq[T]) = (n, lists) match { | |
case (n, (heads, e +: tails)) if (n > 0) => go(n - 1, (e +: heads, tails)) | |
case (_, (heads, tails)) => (heads.reverse, tails) |
NewerOlder