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
import scala.reflect.macros.blackbox
import scala.language.experimental.macros
import scala.annotation.StaticAnnotation
object union {
def impl(c: blackbox.Context)(annottees: c.Expr[Any]*): c.Expr[Any] = {
import c.universe._
@dgouyette
dgouyette / file1.txt
Created September 23, 2015 09:28
Created via API
Demo
@dgouyette
dgouyette / ShapeLessSpec.scala
Created August 18, 2015 15:30
Basic tests with shapeless
import org.scalatest._
import shapeless._
class ShapeLessSpec extends FlatSpec with ShouldMatchers {
object Add1 extends Poly1 {
implicit def caseInt = at[Int](x => x)
}
object Add2 extends Poly2 {
@dgouyette
dgouyette / BowlingScoreShapeless.scala
Last active August 29, 2015 14:27
Bowling shapeless
import org.scalatest._
import shapeless.{HList, HNil}
import shapeless._, nat._, shapeless.ops.hlist.{LeftReducer, Length}, ops.nat.{Mod, Prod, Sum}
object BowlingScoreShapeless {
type Manche = Int :: Int :: HNil
type DerniereManche = Int :: Int :: Int :: HNil
type Game = Manche :: HNil
@dgouyette
dgouyette / BowlingSpec.scala
Last active August 29, 2015 14:27
kata bowling
import org.scalatest._
object BowlingScore{
def score(i: Int*) :Int = {
score(i.toList)
}
@dgouyette
dgouyette / temp.ino
Created August 6, 2015 20:35
temp arduino
#include <SPI.h>
#include <Ethernet.h>
#include <DHT11.h>
int pin=2;
DHT11 dht11(pin);
@dgouyette
dgouyette / filterTransform.scala
Last active August 29, 2015 14:09
filterTransform
val objTransformer =
(__ \ "_embedded" \ "contract").json.copyFrom(
(__ \ "contract").readNullable[JsArray].map(_.getOrElse(JsArray()))
) and
(__ \ "_embedded" \ "comment").json.copyFrom(
(__ \ "comment").readNullable[Comment].filter(reviewOpt => isApproved(reviewOpt))
)
(__ \ "title").readNullable[String].map(_.fold(JsObject(Nil))(s => Json.obj("title" -> s)))
" Authors: http://vim.wikia.com/wiki/Vim_on_Freenode
" Description: A minimal, but feature rich, example .vimrc. If you are a
" newbie, basing your first .vimrc on this file is a good choice.
" If you're a more advanced user, building your own .vimrc based
" on this file is still a good idea.
"------------------------------------------------------------
" Features {{{1
"
" These options and commands enable some very useful features in Vim, that
@dgouyette
dgouyette / .tmux.conf
Last active August 29, 2015 14:00
Conf tmux
# Our .tmux.conf file
# Setting the prefix from C-b to C-a
# START:prefix
#set -g prefix C-a
# END:prefix
# Free the original Ctrl-b prefix keybinding
# START:unbind
#unbind C-b
# END:unbind
@dgouyette
dgouyette / gist:8740998
Created January 31, 2014 19:14
Enable JMX Grails
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=9004
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false