Skip to content

Instantly share code, notes, and snippets.

internal class Database(uri: String, user: String, password: String) {
private val driver = GraphDatabase.driver(uri, AuthTokens.basic(user, password))
val asyncSession: AsyncSession
get() = driver.session(AsyncSession::class.java, SessionConfig.forDatabase("neo4j"))
val session: Session
get() = driver.session(SessionConfig.forDatabase("neo4j"))
fun query(query: String, params: Map<String, Any> = emptyMap()): Flow<Record> = channelFlow {
@TheDome0
TheDome0 / nginx.conf
Created January 18, 2024 19:00
Nginx rules for multilingual sites
set $lang "en";
if ( $http_accept_language ~ ^(..) ) {
set $lang $1;
}
location / {
if ($request_uri ~ ^/(.*).html) {
return 302 /$1$is_args$args;
}
if ($request_uri !~ "^/[a-z]{2}/(.*)") {
return 302 https://$host/$lang$request_uri;
@TheDome0
TheDome0 / KorGE-Player-Movement.kt
Created December 6, 2022 12:47 — forked from TobseF/KorGE-Player-Movement.kt
KorGE setup for super smooth player movement by keys or mouse-click
private var destination: Point = player.pos.copy()
private val playerSpeed = 6.0
private val step = 20
init {
addUpdater {
handeKeyboardControls()
}
addFixedUpdater(25.milliseconds) {
if (destination.distanceTo(player.pos) > playerSpeed) {
create = (properties = {}, children = [], attrs = {}) => children.reduce((e, curr) => (e.appendChild(curr), e), Object.entries(attrs).reduce((e, [k, v]) => (e.setAttribute(k, v), e), Object.assign(document.createElement(properties.tag), properties)));