´´´
DROP TABLE A;
CREATE TABLE A ( id CHARACTER VARYING(255) NOT NULL PRIMARY KEY, modified_at TIMESTAMP WITHOUT TIME ZONE NOT NULL DEFAULT NOW(),
category CHARACTER VARYING(255) NOT NULL, is_active boolean NOT NULL DEFAULT TRUE
# see: https://gist.github.com/l1x/3863190 | |
#http://stackoverflow.com/a/6457473/127508 | |
git checkout 56e05fced -- . | |
git add . | |
git commit -m 'Revert to 56e05fced' | |
And to prove that it worked: | |
git diff 56e05fced |
open -a /Applications/IntelliJ\ IDEA.app |
# .bashrc: see: https://stackoverflow.com/questions/33760647/makefile-autocompletion-on-mac | |
function _makefile_targets { | |
local curr_arg; | |
local targets; | |
# Find makefile targets available in the current directory | |
targets='' | |
if [[ -e "$(pwd)/Makefile" ]]; then | |
targets=$( \ | |
grep -oE '^[a-zA-Z0-9_-]+:' Makefile \ |
@Bean | |
fun container( | |
): KafkaMessageListenerContainer<String, String> { | |
val listener = object : AcknowledgingMessageListener<String, String> { | |
override fun onMessage(record: ConsumerRecord<String, String>, acknowledgment: Acknowledgment) { | |
logger.info { "Received: ${record.value()}" } | |
val event: NewMailEvent = deserializeEvent(eventJson = record.value()) ?: return | |
try { | |
newMailEventHandler.handle(newMailEvent = event) | |
} catch (all: Exception) { |
// https://blog.yo1.dog/updating-enum-values-in-postgresql-the-safe-and-easy-way/ | |
ADD VALUE (PG 9.x) | |
========= | |
# PG 9.6: works from flyway. | |
ALTER TYPE AUDIT_DATABASE_EVENT_TYPE ADD VALUE 'foo'; | |
RENAME VALUE (PG 10.x) | |
============= | |
# PG 10.+: works from flyway (not supported in PG 9.x) |
infix fun <T,O>List<T>.cartesianProduct(others:List<O>):List<Pair<T,O>> = | |
flatMap{ t:T-> | |
others.map { o-> Pair(t,o) } | |
} | |
inline fun <T, O, R> List<T>.mapCartesianProduct(others: List<O>, transform: (Pair<T, O>) -> R): List<R> = | |
flatMap { t: T -> | |
others.map { o -> transform(Pair(t, o)) } | |
} |
/** | |
* Example: forward compose | |
* | |
* see: | |
* - https://discuss.kotlinlang.org/t/pipe-forward-operator/2098/43 | |
* - https://hackernoon.com/funktionale-function-composition-for-kotlin-1f6e3e3c3a83 | |
* | |
* val composition = ::sqrt thenAlso ::println then ::sqrt thenAlso ::println | |
* val result:Double = composition(16.0) | |
*/ |
import com.fasterxml.jackson.databind.ObjectMapper | |
import com.fasterxml.jackson.module.kotlin.convertValue | |
import org.springframework.boot.context.properties.bind.Bindable | |
import org.springframework.boot.context.properties.bind.Binder | |
import org.springframework.core.env.Environment | |
/* | |
Example: | |
val stuff:MyAwesomeDataClass = bindEnvironmentProperties( |
´´´
DROP TABLE A;
CREATE TABLE A ( id CHARACTER VARYING(255) NOT NULL PRIMARY KEY, modified_at TIMESTAMP WITHOUT TIME ZONE NOT NULL DEFAULT NOW(),
category CHARACTER VARYING(255) NOT NULL, is_active boolean NOT NULL DEFAULT TRUE
docker run --rm -v ${PWD}:/local swaggerapi/swagger-codegen-cli generate \ | |
-i /local/swagger.json \ | |
-l kotlin \ | |
-o /local/out/kotlin | |
# help | |
docker run --rm -v ${PWD}:/local swaggerapi/swagger-codegen-cli help generate | |