Skip to content

Instantly share code, notes, and snippets.

Doing my stuff

Filippo De Luca filosganga

Doing my stuff
Block or report user

Report or block filosganga

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
filosganga / GuavaFutures.scala
Created Sep 16, 2017
How to convert a Guava ListeanbelFuture to Cats Async
View GuavaFutures.scala
import cats.effect.Async
import{FutureCallback, Futures, ListenableFuture}
import scala.concurrent.ExecutionContext
object GuavaFutures {
implicit class RichListenableFuture[T](lf: ListenableFuture[T]) {
def toAsync[F[_]: Async](implicit ec: ExecutionContext): F[T] = {
View time-avro-example.avsc
"type" : "record",
"name" : "TimeExamples",
"namespace": "com.example",
"fields" : [
"name": "aDate",
"type": "int"
"logicalType": "date"
filosganga / ResourceMapStage.scala
Last active Mar 23, 2017
A map stage that control a resource lifecycle.
View ResourceMapStage.scala
import{GraphStage, GraphStageLogic, InHandler, OutHandler}
import scala.util.control.NonFatal
class ResourceMapStage[In, Out, R](opener: () => R, closer: R => Unit, f: R => In Out) extends GraphStage[FlowShape[In, Out]] {
val in = Inlet[In]("")
val out = Outlet[Out]("ResourceMap.out")

Keybase proof

I hereby claim:

  • I am filosganga on github.
  • I am filippodeluca ( on keybase.
  • I have a public key ASC15nUa_a2CLHbteLCqNLcJOdILRNSHq5YRpdaV2xplzAo

To claim this, I am signing this object:

View blockchainID
Verifying that +filosganga is my blockchain ID.
filosganga / .gitignore
Last active Aug 29, 2015 — forked from mpilquist/.gitignore
Simulacrum Example
View CssParser.scala
import util.parsing.combinator.JavaTokenParsers
case class Rule(val selectors : List[String], val properties : List[Property])
case class Property(name: String, value: String)
object CssParser extends JavaTokenParsers {
def rules = rule+
filosganga / CycleIterator.scala
Created Oct 27, 2013
An Iterator that cycles trough the given elements
View CycleIterator.scala
class CycleIterator[B <: A, +A](elements: Iterable[B]) extends Iterator[A] {
var iterator: Iterator[B] = Iterator.empty
def hasNext: Boolean = {
if (!iterator.hasNext) {
iterator = elements.iterator
filosganga /
Last active Dec 26, 2015
It implements an Iterable that take elements from a list of Iterable in a round robin fashion. The test is most explicative than the description.
import static;
import static;
import static;
import static java.util.Arrays.asList;
import java.util.Iterator;
filosganga / FizzBuzz.scala
Created Nov 7, 2012
FizzBuzz implementation
View FizzBuzz.scala
class FizzBuzz(divisors = Map(3->"Fizz", 5->"Buzz")) {
def fizzBuzz(n: Int): String = {
divisors.foldLeft(""){(res, d)=>
n % d._1 match {
case 0 => res + d._2
case _ => res
} match {
case "" => n.toString
You can’t perform that action at this time.