This file contains 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
/** | |
The MIT License (MIT) | |
Copyright (c) 2013 Jean Helou | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is |
This file contains 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
implicit val venueReader: Reads[Venue] = ( | |
(__ \ "address").readNullable[String] and | |
(__ \ "address_2").readNullable[String] and | |
(__ \ "city").readNullable[String] and | |
(__ \ "region").readNullable[String] and | |
(__ \ "country").readNullable[String] and | |
(__ \ "postal_code").readNullable[String] | |
)(Venue) | |
implicit val eventbriteEventReader: Reads[EventbriteEvent] = |
This file contains 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 com.sun.net.httpserver.HttpExchange; | |
import com.sun.net.httpserver.HttpServer; | |
import java.io.IOException; | |
import java.net.InetSocketAddress; | |
public class WebMain { | |
public static void main(String[] args) throws IOException { | |
WebServer.serve(8080, "/").withRoute( |
This file contains 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
object MyApp extends App { | |
case class Bag[+A](value: A) { // covariance | |
//override def toString = "toto" | |
//def copy | |
//equals | |
//hashcode | |
// + elem de Product | |
// functor dans la théorie des catégories | |
def map[B](f: A => B): Bag[B] = Bag(f(value)) |
This file contains 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
use OneCalendar | |
db.events.save({ | |
"title" : "my great record", | |
"begin" : NumberLong(new String(new Date(new Date().getTime()+1000*60*60*24).getTime())), | |
"end" : NumberLong(new String(new Date(new Date().getTime()+3000*60*60*24).getTime())), | |
"location" : "anywhere i want", | |
"description" : "", | |
"tags" : [ | |
"TAG1" | |
] |
This file contains 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
PURPLE=$(echo -en "\033[35m") | |
GREEN=$(echo -en "\033[32m") | |
RED=$(echo -en "\033[31m") | |
YELLOW=$(echo -e "\033[33m") | |
BLUE=$(echo -e "\033[1;34m") | |
NORMAL=$(echo -e "\033[0m") | |
mvn2() { | |
mvn $* | sed \ | |
-e "s/^\(.ERROR. .*\)$/$RED\1$NORMAL/ ; #contain ERROR start 2nd char |
This file contains 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
#!/usr/bin/env bash | |
# Formatting constants | |
export BOLD=`tput bold` | |
export UNDERLINE_ON=`tput smul` | |
export UNDERLINE_OFF=`tput rmul` | |
export TEXT_BLACK=`tput setaf 0` | |
export TEXT_RED=`tput setaf 1` | |
export TEXT_GREEN=`tput setaf 2` | |
export TEXT_YELLOW=`tput setaf 3` |