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
# close all waiting workflows | |
gh run list --limit 100 --status waiting --json databaseId --jq '.[].databaseId' | grep -v "USE THIS TO ECLUDE WORKFLOWS" | xargs -l gh run cancel | |
# close all prs | |
gh pr list --json number --jq '.[].number' | grep -v "USE THIS TO EXCLUDE A FEW" | xargs -l gh pr close |
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 ConfigurationLoader { | |
val log: Logger = LoggerFactory.getLogger(ConfigurationLoader::class.java) | |
/** Applications should rely on overriding env vars in the default profiles. This mechanism can be simplified */ | |
private val profileKeys = listOf("profileOverride") // used to be "profile", "profiles", "spring.profiles.active" | |
private fun lazyCheckSystemProperty(name: String): Lazy<String?> = checkProfileVia("system property", name) { System.getProperty(name) } | |
private fun lazyCheckEnvVar(name: String): Lazy<String?> = checkProfileVia("environment var", name) { System.getenv(name) } | |
private fun checkProfileVia(source: String, name: String, supplier: () -> String?) = lazy { |
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
class IndexingDataStructure<V>(private val lock: Any = Any()) { | |
abstract inner class Index<KEY, RETURN>(val name: String, protected val keyFromValueFunc: (value: V) -> KEY) { | |
abstract fun get(key: KEY): RETURN | |
internal abstract fun internalIncludeItem(value: V) | |
} | |
inner class UniqueIndex<KEY>(name: String, keyFromValueFunc: (value: V) -> KEY, private val map: MutableMap<KEY, V> = mutableMapOf()) : Index<KEY, V?>(name, keyFromValueFunc) { | |
override fun get(key: KEY): V? = synchronized(lock) { map[key] } |
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.lang.Exception | |
import kotlin.reflect.KClass | |
import kotlin.reflect.full.isSubtypeOf | |
import kotlin.reflect.full.starProjectedType | |
import kotlin.reflect.jvm.javaType | |
import org.slf4j.Logger | |
// the handlers should throw, but this throw is here so we can use Nothing | |
// as return type. By using Nothing, this method can be called without having | |
// actually return something |
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
if [ -e $FILE ]; | |
then | |
echo "Usage:" | |
echo "FILE=https://some/location/swagger.yml ./run-swagger-ui.sh" | |
exit 1 | |
fi | |
curl -s -o swagger.yml $FILE | |
echo visit http://localhost:8080 rendering docs of $FILE | |
echo ctrl + c to stop |
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/bash | |
set -e | |
# command taken from https://github.com/JLLeitschuh/ktlint-gradle task addKtlintFormatGitPreCommitHook | |
filesToFormat="$(git --no-pager diff --name-status --no-color --cached | awk '$1 != "D" && $2 ~ /\.kts|\.java|\.kt/ { print $NF}')" | |
echo "files to format $filesToFormat" | |
for sourceFilePath in $filesToFormat | |
do | |
./gradlew spotlessApply -PspotlessIdeHook="$(pwd)/$sourceFilePath" |
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
data class Entry( | |
val age: Int, | |
val name: String, | |
val ziek: String, | |
val datum: String, | |
val afwezig: String | |
) | |
fun main() { |
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
@SpringBootApplication() | |
public class Application { | |
public static void main(String[] args) { | |
SpringApplication.run(Application.class, args); | |
} | |
@Bean | |
@Qualifier("completableFutureWorkerPool") | |
public Executor asyncTaskExecutor() { | |
return Executors.newCachedThreadPool(new CustomizableThreadFactory("completableFutureWorkerPool-")); |
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 nl.toefel.kotlin.html.dsl | |
fun html(init: HTML.() -> Unit): HTML { | |
val html = HTML() | |
html.init() | |
return html | |
} | |
interface Element { |
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 React, { useState } from "react"; | |
import uuid from "uuid/v4"; | |
const Todo = ({ todo, deleteTodo }) => { | |
return ( | |
<li | |
key={todo.id} | |
style={{ textDecoration: todo.completed ? "line-through" : "" }} | |
> | |
{todo.text} <button onClick={() => deleteTodo(todo.id)}>X</button> |
NewerOlder