Skip to content

Instantly share code, notes, and snippets.

FrancoAra / SerializedComputations.scala
Last active Jan 22, 2019
Serialize arbitrary computations and run them on a different machine while keeping type safety
View SerializedComputations.scala
import shapeless._
import shapeless.record._
import shapeless.ops.record._
import syntax.singleton._
object Main extends App {
// === Your normal code base =========================================================================================
FrancoAra / AdventOfCodeSeven.scala
Created Jan 4, 2019
Advent of Code 2018 Day 7
View AdventOfCodeSeven.scala
import cats._
import cats.effect.{ExitCode, IO, IOApp}
import cats.implicits._
// Tweet:
object Main extends IOApp {
FrancoAra / TaglessFinal.scala
Created Aug 5, 2018
Tagless final is a flexible and powerful design pattern in functional programming, this gist tries to give a brief explanation of it.
View TaglessFinal.scala
import scala.concurrent.{ExecutionContext, Future}
import Monad.syntax._
import scalaz.reactive.tmp.lambda_tickets.{HttpImplementation, Id, MockedImplementation}
object tickets {
// Q: How many implementations does this have? A: mathematically infinite
// Q: How many implementations differ from the one you intended? A: mathematically infinite
FrancoAra / Heroes.scala
Created Mar 31, 2017
Typeclasses Workshop
View Heroes.scala
/* See: */
sealed trait FrostSpell extends Product with Serializable
case object Blizzard extends FrostSpell
case object Icebolt extends FrostSpell
object FrostSpell {
implicit val ordering: Ordering[FrostSpell] = new Ordering[FrostSpell] {
override def compare(x: FrostSpell, y: FrostSpell): Int = (x,y) match {
FrancoAra /
Created May 2, 2012
Android class, downloads an image from an url and sets it in the an ImageView.
* Instantiate this class and use the method "execute", just give the image url and the ImageView where you want to set it.
* Notice that you may only use the method once, you need to have one object per image request.
* You don't have to worry about threads or blocking your app, this is handled with the AsyncTask class.
FrancoAra / bin\app
Created Apr 24, 2012
Handles commands, options and parameters to call a nodejs app
View bin\app
#!/usr/bin/env node
// This file has to have execution permission.
// You can do it with 'sudo chmod 777 thisfile', will give write, read and execute permissions to everyone.
// To execute it from terminal be sure that your $PATH is updated, adding the path of this file to it.
var delegate = require('../lib/delegate') // Replace delegate with the module which will handle the commands functionality.
var args = new ArgumentsCollection();
// # Declaration of your app arguments