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 static org.hamcrest.MatcherAssert.assertThat; | |
import static org.hamcrest.Matchers.equalTo; | |
import java.io.File; | |
import java.io.IOException; | |
import java.io.OutputStream; | |
import java.nio.charset.StandardCharsets; | |
import java.util.Arrays; |
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
@Test | |
public void shouldCheckWhetherWeHaveAnUsernameAlreadyInUseErrorCode() { | |
ServiceException e = new ServiceException("ERR500|532323"); | |
assertThat(e, hasErrorCode(usernameAlreadyInUse())); | |
} |
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 com.zuhlke.lsapi; | |
import org.bouncycastle.crypto.PBEParametersGenerator; | |
import org.bouncycastle.crypto.digests.SHA3Digest; | |
import org.bouncycastle.crypto.generators.PKCS5S2ParametersGenerator; | |
import org.bouncycastle.crypto.params.KeyParameter; | |
import org.bouncycastle.crypto.prng.DigestRandomGenerator; | |
import java.util.Base64; |
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
#!/bin/bash | |
keytool -genkey -keyalg RSA -alias selfsigned -keystore keystore.jks -storepass password -validity 360 -keysize 2048 |
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
<html ng-app="app"> | |
<head> | |
<meta charset="utf-8"> | |
<script src="http://cdnjs.cloudflare.com/ajax/libs/mathjs/1.0.1/math.js"></script> | |
</head> | |
<body ng-controller="MoneyController as ctrl"> | |
<p> | |
Total: <input type="number" ng-model="ctrl.total"> | |
</p> |
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
function OrderFactory($http) { | |
function Order(order) { | |
angular.extend(this, order || {}); | |
this.toppings = this.toppings || {}; | |
} | |
Order.prototype.addTopping = function(topping) { | |
this.toppings.push(topping); | |
}; |
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
fun <R> retry( | |
maxAttempts: Int, | |
action: () -> R | |
): R { | |
require(maxAttempts > 0) { "maxAttempts must be greater than 0" } | |
return runCatching(action).getOrElse { | |
val leftAttempts = maxAttempts.dec() | |
if (leftAttempts == 0) throw it | |
retry(leftAttempts, action) | |
} |
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
// uses value4k: https://github.com/fork-handles/forkhandles/tree/trunk/values4k | |
class PaginationToken private constructor(value: String) : StringValue(value) { | |
companion object : NonBlankStringValueFactory<PaginationToken>(::PaginationToken) | |
} | |
data class PagedResult<T>( | |
private val result: List<T> = emptyList(), | |
val token: PaginationToken? = null | |
) : List<T> by result { | |
companion object |
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
function git_random_branch() { | |
randomword=`shuf /usr/share/dict/words | head -1 | awk '{print tolower($0)}'` | |
branchname="kevin_${randomword}" | |
git create-branch -r ${branchname} | |
} | |
git_random_branch() |
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
FROM openjdk:14-jdk-alpine3.10 | |
ENV PLANTUML_VERSION=1.2022.4 | |
ENV LANG en_US.UTF-8 | |
RUN \ | |
apk add --no-cache graphviz wget ca-certificates && \ | |
apk add --no-cache graphviz wget ca-certificates ttf-dejavu fontconfig && \ | |
mkdir /app && \ | |
wget "https://github.com/plantuml/plantuml/releases/download/v${PLANTUML_VERSION}/plantuml-${PLANTUML_VERSION}.jar" -O /app/plantuml.jar && \ | |
apk del wget ca-certificates | |
RUN ["java", "-Djava.awt.headless=true", "-jar", "/app/plantuml.jar", "-version"] |
OlderNewer