This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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._ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Demo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.scalatest._ | |
object BowlingScore{ | |
def score(i: Int*) :Int = { | |
score(i.toList) | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <SPI.h> | |
#include <Ethernet.h> | |
#include <DHT11.h> | |
int pin=2; | |
DHT11 dht11(pin); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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))) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-Dcom.sun.management.jmxremote | |
-Dcom.sun.management.jmxremote.port=9004 | |
-Dcom.sun.management.jmxremote.ssl=false | |
-Dcom.sun.management.jmxremote.authenticate=false |