Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am agile-jordi on github.
  • I am jordipradel (https://keybase.io/jordipradel) on keybase.
  • I have a public key ASCTV_oEP96p1Tu6xD0CI_aTtgPXhVJAm0w-xXApTw0Sego

To claim this, I am signing this object:

package com.agilogy.talks.errorhandling.extra
import com.agilogy.talks.errorhandling.Email
import scala.language.higherKinds
import scala.util.{Failure, Success, Try}
case class IllegalEmail(email:String) extends Exception
sealed trait ErrorHandlingStyle{
package ut
import com.agilogy.talks.errorhandling.Email
import com.agilogy.talks.errorhandling.extra._
import org.scalatest.FreeSpec
import scala.util.{Failure, Success}
class ChooseYourOwnStyleTest extends FreeSpec {
@agile-jordi
agile-jordi / TypeCionstraints.scala
Last active August 29, 2015 14:22
Scala type constraints =:= and <:<
object TypeConstraints{
// Define some hierarchy
trait Pet
class Dog(name:String) extends Pet
object Dog{
def apply(name:String):Dog = new Dog(name)
}
case class Alsatian(name:String) extends Dog(name)
case class Cat(name:String) extends Pet
@agile-jordi
agile-jordi / 0_reuse_code.js
Created March 10, 2014 15:19
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@agile-jordi
agile-jordi / EnumJson
Last active April 22, 2016 05:06
An object with functions the create Reads, Writes or Formats for Enums.
// With an enumeration like...
// object Color extends Enumeration{...}
// Create a format (or reads or writes) like this:
// val fmt = EnumJson.enumFormat(Color);
// The implementation
object EnumJson {
def enumReads[E <: Enumeration](enum: E): Reads[E#Value] = new Reads[E#Value] {