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 Association du Paris Java User Group. | |
* | |
* 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 furnished to do so, |
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
package org.zaptravel.logback.fluentd; | |
import java.net.InetAddress; | |
import java.net.UnknownHostException; | |
import java.util.HashMap; | |
import java.util.Map; | |
import ch.qos.logback.classic.spi.LoggingEvent; | |
import ch.qos.logback.core.UnsynchronizedAppenderBase; | |
import org.apache.commons.lang3.StringEscapeUtils; |
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
package org.zaptravel.logback.fluentd; | |
import java.util.concurrent.BlockingQueue; | |
import java.util.concurrent.ExecutorService; | |
import java.util.concurrent.Executors; | |
import java.util.concurrent.LinkedBlockingQueue; | |
import java.util.concurrent.TimeUnit; | |
import java.util.concurrent.atomic.AtomicBoolean; | |
import org.slf4j.Logger; |
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
{ | |
"max": "10", | |
"eventId": 5, | |
"start": "0", | |
"tickets": [ | |
{ | |
"invoiceState": "PAID", | |
"modifiedTime": 1354710165000, | |
"tagId": "unassigned", | |
"optIn": false, |
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
case class TicketRequest(max: String, eventId: Long, start: String, tickets: List[Ticket]) | |
case class Ticket(modifiedOn: Date, | |
optIn:Boolean, | |
ticketId: Long, | |
email:String, | |
invoiceState:String, | |
ticketType: String, | |
modifiedTime: Long, | |
partnerCode: String, |
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
// This is a comparison between Haskell and Groovy based on some simple problems found in the following | |
// Haskell Introduction: | |
// http://learnyouahaskell.com/starting-out#ready-set-go | |
// Ex 1. If we have two lists, [2,5,10] and [8,10,11] and we want to get the products of all the possible | |
// combinations between numbers in those lists, here's what we'd do. | |
/* HASKELL */ | |
[ x*y | x <- [2,5,10], y <- [8,10,11]] |
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
package library | |
import org.sedis.Pool | |
import redis.clients.jedis.{JedisPoolConfig, JedisPool} | |
import play.api.Play.current | |
import org.apache.commons.pool.impl.GenericObjectPool | |
/** | |
* Redis connection wrapper. | |
* You can configure the server details in the application.conf with: |
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
def getOrigin(originId: Long): Option[Origin] = Redis.pool.withClient { | |
client => | |
for(slug<-Option(client.hget("Url:From:Rev", originId.toString)); | |
display<-Option(client.hget("Places:Place:"+originId, "display") | |
)) yield Origin(originId,display,slug) | |
} | |
} |
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
package models | |
import org.specs2.mutable._ | |
import play.api.test._ | |
import play.api.test.Helpers._ | |
class OriginSpecs extends Specification { | |
"An Origin" should { | |
"returns the slug for a valid origin" in { |
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
package models | |
import play.libs.WS | |
import play.api.libs.json.JsValue | |
import play.api.libs.json.Json._ | |
import scala.Some | |
import play.api.libs.EventSource | |
import org.apache.commons.lang.StringUtils | |
// Define a generic event, |