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 java.util.function.Consumer; | |
import java.util.function.Function; | |
import java.util.function.Supplier; | |
public class UtilException<E extends Exception> { | |
private static final UtilException INSTANCE = new UtilException(); | |
@SuppressWarnings("unchecked") | |
public static <E extends Exception> UtilException<E> create() throws E { | |
return INSTANCE; |
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 com.impressiveinteractive.playground; | |
import java.util.ArrayList; | |
import java.util.List; | |
import java.util.Optional; | |
import org.junit.Rule; | |
import org.junit.Test; | |
import org.junit.rules.ExpectedException; |
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
ಠ_ಠ(new IOException("Disk blew up.")) | |
... | |
public <T extends Throwable> void ಠ_ಠ(T exception) throws T{ | |
throw exception; | |
} |
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 java.util.HashMap; | |
import java.util.Map; | |
import java.util.Optional; | |
import java.util.Set; | |
import java.util.function.Function; | |
import java.util.regex.Matcher; | |
import java.util.stream.Collectors; | |
import com.google.common.collect.ImmutableList; | |
import com.google.common.collect.ImmutableMap; |
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 java.util.ArrayList; | |
import java.util.HashSet; | |
import java.util.LinkedList; | |
import java.util.List; | |
import java.util.Set; | |
import java.util.TreeSet; | |
import java.util.stream.Collectors; | |
import java.util.stream.Stream; | |
import com.google.common.collect.ImmutableList; |
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 org.slf4j.helpers.FormattingTuple; | |
import org.slf4j.helpers.MessageFormatter; | |
/** | |
* Base {@link Exception} class that allows developers to use the log4j message style formats to create exception messages | |
* and pass along exception causes. | |
*/ | |
public class FormattedException extends Exception { | |
public FormattedException(String format, Object... arguments) { |
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
#!/bin/sh | |
if [ $# -ne 2 ] || [ $1 -lt -36 ] || [ $1 -gt 35 ] | |
then | |
echo 'Please specify how many random words would you like to generate !' 1>&2 | |
echo 'example: caesar 5 "mjh5i9n 9pio 8jhpn"' 1>&2 | |
echo 'This will do a caesar cipher of 5 places on the given string, returning romanes eunt domus' 1>&2 | |
exit 0 | |
fi |
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
#!/bin/sh | |
if [ $# -gt 2 ] || [ $# -lt 1 ] | |
then | |
echo 'Specify the path to the value first and optionally the field name second.' 1>&2 | |
exit 0 | |
fi | |
if [ $# -eq 2 ] | |
then |
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 java.io.File; | |
import java.util.Arrays; | |
import java.util.stream.Stream; | |
public class StreamFiles { | |
public static Stream<File> recursive(File file) { | |
File[] listed = file.listFiles(); | |
if (listed == null) { | |
return Stream.of(file); | |
} |
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 | |
set -e | |
OLD_BASE=$1 # v1.0.0-step-1 | |
ADDITION=$2 | |
N=$'\n' | |
ME="$( basename ${BASH_SOURCE[0]} )" | |
DRY_RUN=false |
OlderNewer