Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Doing my stuff

Filippo De Luca filosganga

💭
Doing my stuff
View GitHub Profile
@filosganga
filosganga / RoundRobinIterable.java
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.
View RoundRobinIterable.java
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.collect.Iterables.filter;
import static com.google.common.collect.Iterators.cycle;
import static java.util.Arrays.asList;
import java.util.Iterator;
import com.google.common.base.Function;
import com.google.common.base.Predicate;
import com.google.common.collect.FluentIterable;
View blockchainID
Verifying that +filosganga is my blockchain ID. https://onename.com/filosganga
@filosganga
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
@filosganga
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+