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.util.concurrent.* | |
import kotlin.reflect.* | |
import kotlinx.coroutines.* | |
class SynchronousEventEmitter( | |
private val onError: (error: Throwable, event: Event) -> Unit, | |
) : EventEmitter, EventSource { | |
private val subscriptions = CopyOnWriteArraySet<Subscription<*>>() |
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
// … | |
new TerserPlugin({ | |
terserOptions: { | |
// ecma: "2016", // doesn't work with some libraries | |
compress: { | |
keep_fargs: false, | |
negate_iife: false, | |
passes: 5, // 4 was highest number observed to date that results in even smaller code | |
pure_funcs(node) { | |
// noinspection JSUnresolvedVariable |
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
;+function () { | |
// noinspection JSUnresolvedFunction,NpmUsedModulesInstalled | |
const TerserPlugin = require('terser-webpack-plugin') | |
// noinspection JSUnresolvedVariable | |
if (config.mode === 'production') { | |
// noinspection JSUnresolvedVariable,SpellCheckingInspection,JSUnusedGlobalSymbols | |
config.optimization = { | |
minimize: true, | |
minimizer: [ |
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.time.* | |
import kotlin.time.* | |
import kotlin.time.Duration | |
import kotlinx.coroutines.* | |
import kotlinx.coroutines.flow.* | |
private object Done | |
private object TimerExpired |
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
public external interface StringBuilder | |
public inline fun StringBuilder.append(value: Any) { | |
append("$value") | |
} | |
public inline fun StringBuilder.append(string: String) { | |
if (string != "") |
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
@JsName("require") | |
external fun asset(path: String): String | |
// in a React builder | |
img(src = asset("image.png")) {} |
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
/* Output | |
Collecting 2 elements… | |
upstream -> hot | |
emit: 0 | |
resumed | |
collect: 0 | |
Expensive work on 0 (isPaused = false)… | |
Expensive work on 0 (isPaused = false)… | |
Expensive work on 0 (isPaused = false)… |
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 kotlinx.coroutines.* | |
import kotlinx.coroutines.flow.* | |
/* Output: | |
cache collected: initial | |
flow1 (collector 1) collected: initial | |
flow1 (collector 2) collected: initial | |
flow2 (collector 1) collected: initial |
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 io.ktor.application.* | |
import io.ktor.client.* | |
import io.ktor.client.engine.* | |
import io.ktor.client.engine.apache.* | |
import io.ktor.client.engine.cio.* | |
import io.ktor.client.engine.jetty.* | |
import io.ktor.client.engine.okhttp.* | |
import io.ktor.client.request.* | |
import io.ktor.client.statement.* | |
import io.ktor.http.* |
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 io.ktor.application.* | |
import io.ktor.client.* | |
import io.ktor.client.engine.cio.* | |
import io.ktor.client.request.* | |
import io.ktor.client.statement.* | |
import io.ktor.http.* | |
import io.ktor.response.* | |
import io.ktor.routing.* | |
import io.ktor.server.engine.* | |
import io.ktor.server.netty.* |
NewerOlder