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
package utils | |
/** | |
* From 'How to unsuck Future[Option[T]]' by Erik Bakker. | |
* Operator taken from Scalaz which allow to specify a function in a different order. | |
* | |
* This operator allows to move transformations in for-comprehension to the right | |
* which makes the code easier to read. | |
*/ | |
object ThrushOperator { |
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
/** | |
* True non-blocking sequence implementation. | |
* Does _NOT_ use 'join' or 'get' | |
* Creates a new CompletableFuture (aka a promise) which is only completed | |
* once all futures have completed either successfully or with failures. | |
* Failures are ignored, but could also be accumulated if the result type would not be List | |
* but a SequenceResult for example which would contain both the list of result and list of errors | |
* and, this class could even extend List. | |
*/ | |
package eu.allego.ag.authoriser; |
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
# Loop over folders and count the files in the folder | |
find . -maxdepth 1 -mindepth 1 -type d | while read dir; do | |
printf "%-25.25s : " "$dir" | |
find "$dir" -type f | wc -l | |
done |
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
object SeqWithDistinctOn { | |
/** Utility class to run a distinct function on */ | |
case class DistinctResult[A, B](val items: Seq[A] = Seq.empty, val keys: Seq[B] = Seq.empty) { | |
/** | |
* Add item with given key. | |
* If key already exists, the item will not be added. | |
* | |
* @param item Item to be added if #key has not been added yet. | |
* @param key Key of item. | |
* @return A [[DistinctResult]] with added item of key did not exist, otherwise current [[DistinctResult]]. |
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
<!-- | |
* Copyright (c) Facebook, Inc. | |
* All rights reserved. | |
* | |
* | |
* This source code is licensed under the license found in the | |
* LICENSE file in the root directory of this source tree. | |
--> | |
<!-- Custom graphiql with jwt header |
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
/** | |
* Extend [[Seq]] with a function to seperate an element into multiple parts. | |
* This allows to go over the [[Seq]] only once and retrieve multiple [[Seq]]s as a result. | |
* Convenient for changing a Seq of [[Tuple2]] into 2 Seq's of the tuple elements. | |
*/ | |
implicit class SeqWithSplitOn[A](val seq: Seq[A]) extends AnyVal { | |
/** | |
* Split an element into 2 parts using function `f`. | |
* Note: simply use the [[identity()]] function for splitting a [[Tuple2]] element. | |
* |
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
/** | |
* Java 8 does not full support ISO8601 date/time format. (https://en.m.wikipedia.org/wiki/ISO_8601) | |
* It does not support timezone '±HHMM' or '±HH'. | |
* This has been reported in issue https://bugs.openjdk.java.net/browse/JDK-8032051, | |
* but has only been fixed in Java 9, not in Java 8! | |
* | |
* This object provides an alternative [[Reads]] instance which fully supports ISO8601 formats, | |
* which should be used instead of Play Json's [[play.api.libs.json.EnvReads.DefaultInstantReads]]. | |
*/ | |
object ISO8601 { |
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
/** | |
* In custom Table implementation add a new `Def` or `TypeDef` implementation | |
* and add it to the `definitions`. | |
* | |
* The custom `Def` can conditionally be applied to tables by overriding the `enabled` function. | |
* | |
* This `InsertDef` adds some helper functions to only insert a row based on a predicate. | |
* See https://stackoverflow.com/a/31352126/3309859 for an example. | |
* Since defining the `insert` query is quite cumbersome, I created the generator to generate it. | |
*/ |
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
package flexc.graph.guice.module; | |
import com.google.inject.AbstractModule; | |
import com.google.inject.TypeLiteral; | |
import com.google.inject.matcher.Matchers; | |
import com.google.inject.spi.InjectionListener; | |
import com.google.inject.spi.ProvisionListener; | |
import com.google.inject.spi.TypeEncounter; | |
import com.google.inject.spi.TypeListener; |
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
package json; | |
import com.amazonaws.services.dynamodbv2.model.OperationType; | |
import com.amazonaws.services.dynamodbv2.model.StreamViewType; | |
import com.amazonaws.services.lambda.runtime.events.DynamodbEvent; | |
import com.fasterxml.jackson.annotation.JsonIgnore; | |
import com.fasterxml.jackson.annotation.JsonProperty; | |
import com.fasterxml.jackson.databind.ObjectMapper; | |
import com.fasterxml.jackson.databind.PropertyNamingStrategy; |
NewerOlder