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
type NullableFields<T> = Required<{ | |
[K in keyof T]: {} extends Pick<T, K> ? Exclude<T[K], undefined> | null : T[K] | |
}> | |
interface Person { | |
name: string | |
age?: number | |
} | |
const person: NullableFields<Person> = { |
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 {HttpHandler, HttpRequest, HttpResponse} from "@aws-sdk/protocol-http"; | |
import {HttpHandlerOptions, RequestHandlerMetadata, RequestHandlerOutput} from "@aws-sdk/types"; | |
import {Agent, Dispatcher} from "undici"; | |
export class UndiciHandler implements HttpHandler { | |
private readonly agent = new Agent() | |
metadata: RequestHandlerMetadata = { | |
handlerProtocol: "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 kotlinx.coroutines.flow.Flow | |
import kotlinx.coroutines.flow.collect | |
import kotlinx.coroutines.flow.flow | |
import kotlin.coroutines.Continuation | |
import kotlin.coroutines.CoroutineContext | |
import kotlin.coroutines.EmptyCoroutineContext | |
import kotlin.coroutines.RestrictsSuspension | |
import kotlin.coroutines.resume | |
import kotlin.coroutines.startCoroutine | |
import kotlin.coroutines.suspendCoroutine |
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.security.MessageDigest | |
import kotlin.test.Test | |
import kotlin.test.assertTrue | |
class Scratchpad { | |
@Test | |
fun scratchpad() { | |
val digest = MessageDigest.getInstance("SHA-256") | |
digest.update("foo".toByteArray()) | |
digest.update("bar".toByteArray()) |
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
create temp table t1(t1_id serial primary key, reference varchar(16) not null unique, value varchar(16) not null); | |
copy t1(reference, value) from stdin; | |
FOO foo | |
BAR bar | |
QUUX quux | |
\. | |
create temp view t1_combined as | |
select t1_id, reference, value, ctid, lp_flags, lp_off, case when t_ctid <> ctid then t_ctid end as t_ctid, | |
t_xmin, xmin_visible, case when t_xmax::text <> '0' then t_xmax end as t_xmax, xmax_visible, |