Skip to content

Instantly share code, notes, and snippets.

View dgouyette's full-sized avatar
🏠
Working from home

GOUYETTE Damien dgouyette

🏠
Working from home
View GitHub Profile
@fsarradin
fsarradin / FreeBank.scala
Created June 16, 2017 14:20
Free and State are in a bank
import cats.data.State
import cats.free.Free
import cats.free.Free.liftF
import cats.kernel.Monoid
import cats.~>
type Amount = Double
// ADT for bank operations
sealed trait BankOperation[A]
@freckletonj
freckletonj / oauth.hs
Created April 27, 2017 21:06
Haskell Servant OAuth2.0 for GitHub
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE TypeOperators #-}
module Sand where
import Data.Aeson
@jpallari
jpallari / Main.scala
Last active February 5, 2024 08:29
Ways to pattern match generic types in Scala
object Main extends App {
AvoidLosingGenericType.run()
AvoidMatchingOnGenericTypeParams.run()
TypeableExample.run()
TypeTagExample.run()
}
class Funky[A, B](val foo: A, val bar: B) {
override def toString: String = s"Funky($foo, $bar)"
}
@bfil
bfil / EmbeddedMongo.scala
Created February 18, 2015 23:14
EmbeddedMongo for ReactiveMongo
import java.util.logging.Logger
import scala.concurrent.ExecutionContext
import de.flapdoodle.embed.mongo.{Command, MongodStarter}
import de.flapdoodle.embed.mongo.config.{MongodConfigBuilder, Net, RuntimeConfigBuilder}
import de.flapdoodle.embed.mongo.distribution.Version
import de.flapdoodle.embed.process.config.IRuntimeConfig
import de.flapdoodle.embed.process.config.io.ProcessOutput
import de.flapdoodle.embed.process.runtime.Network
@robpurcell
robpurcell / gist:8391335
Created January 12, 2014 22:11
Iterate through days in a Joda-Time Interval using Groovy
DateTime.metaClass.next << { -> delegate.plusDays(1) }
Interval interval = ...
def start = interval.start
def finish = interval.end
for (day in start..finish) {
// ...
}
@dgouyette
dgouyette / play.rb
Last active December 15, 2015 14:39
Install Play play-2.1.1-RC2 with homebrew
# Recipe for play-2.1.1-RC2
require 'formula'
class Play < Formula
homepage 'http://www.playframework.org/'
url 'http://downloads.typesafe.com/play/2.1.1-RC2/play-2.1.1-RC2.zip'
md5 'ef4b378dae9c6a8711f9f5395e626ca3'
version '2.1.1-RC2'