Skip to content

Instantly share code, notes, and snippets.

View Rattlyy's full-sized avatar
🎉
Festeggiando

Rattly Rattlyy

🎉
Festeggiando
View GitHub Profile
@Rattlyy
Rattlyy / Jte.kt
Last active April 25, 2024 18:19
Simple HMR with Jte and Ktor
import gg.jte.ContentType
import gg.jte.TemplateEngine
import gg.jte.resolve.DirectoryCodeResolver
import gg.jte.watcher.DirectoryWatcher
import io.ktor.server.application.*
import io.ktor.server.jte.*
import io.ktor.server.routing.*
import io.ktor.server.sse.*
import java.nio.file.Path
@Rattlyy
Rattlyy / userscript.js
Created April 16, 2024 07:59
Userscript that filters AZAir's flights
// ==UserScript==
// @name Remove destinations from AZair.eu
// @namespace http://tampermonkey.net/
// @version 2024-04-16
// @description Removes destinations from AZAir search results
// @author Rattlyy
// @match https://www.azair.eu/azfin.php*
// @icon https://www.google.com/s2/favicons?sz=64&domain=azair.eu
// @grant none
// ==/UserScript==
@Rattlyy
Rattlyy / SseBus.kt
Last active March 21, 2024 15:24
Utility to use SSE with Kotlin flows on Quarkus
import jakarta.ws.rs.sse.Sse
import jakarta.ws.rs.sse.SseEventSink
import kotlinx.coroutines.cancel
import kotlinx.coroutines.coroutineScope
import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.flow.collectLatest
private data class Event(val name: String, val data: String)
object SseBus {
private val flows: MutableMap<String, MutableSharedFlow<Event>> = mutableMapOf()