Skip to content

Instantly share code, notes, and snippets.

Francisco Arámburo FrancoAra

Block or report user

Report or block FrancoAra

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
@FrancoAra
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
@FrancoAra
FrancoAra / ImageRequester.java
Created May 2, 2012
Android class, downloads an image from an url and sets it in the an ImageView.
View ImageRequester.java
/*
* 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.
*/
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
@FrancoAra
FrancoAra / Heroes.scala
Created Mar 31, 2017
Typeclasses Workshop
View Heroes.scala
/* See: http://underscore.io/blog/posts/2015/06/04/more-on-sealed.html */
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
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 {
import scala.concurrent.ExecutionContext.Implicits.global
// Q: How many implementations does this have? A: mathematically infinite
// Q: How many implementations differ from the one you intended? A: mathematically infinite
@FrancoAra
FrancoAra / AdventOfCodeSeven.scala
Created Jan 4, 2019
Advent of Code 2018 Day 7
View AdventOfCodeSeven.scala
import cats._
import cats.data.State
import cats.effect.{ExitCode, IO, IOApp}
import cats.implicits._
import scala.io.Source
// Tweet: https://twitter.com/francoaramburo/status/1081303164660473857
object Main extends IOApp {
@FrancoAra
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 =========================================================================================
You can’t perform that action at this time.