Skip to content

Instantly share code, notes, and snippets.

package errutil
import (
"context"
"github.com/samber/lo"
)
func Delay[T any](target *error) func(v T, err error) T {
a := func(v T, err error) T {
@wirekang
wirekang / example.ts
Created May 9, 2022 11:49
Typescript type
interface I1 {
p1: (a: boolean)=>void
p2: (a: string) => void
p3: (a: number) => void
}
const v1:I1 = 0 as any
function f1<T extends keyof I1>(
name: T,
@wirekang
wirekang / compact-naver.md
Last active October 31, 2022 05:50
Compact Naver

image

Elements to hide

www.naver.com##DIV[id="veta_branding"]
www.naver.com##DIV[class="footer_inner"]
www.naver.com##DIV[id="shopcast"]
www.naver.com##DIV[id="NM_FAVORITE"]
@wirekang
wirekang / jobrunr6.0.0.sql
Last active February 8, 2023 06:20
JobRunr 6.0.0 migration(postgres)
CREATE TABLE "jobrunr_migrations"
(
"id" NCHAR(36) PRIMARY KEY,
"script" VARCHAR(64) NOT NULL,
"installedon" VARCHAR(29) NOT NULL
);
CREATE TABLE "jobrunr_jobs"
(
"id" NCHAR(36) PRIMARY KEY,
@wirekang
wirekang / base64_url.sql
Created November 13, 2023 01:46
Postgres web-safe base64 encode
create or replace function "base64_url"(bytea) returns text as
$$
select replace(replace(replace(encode($1, 'base64'),'/','_'),'+','-'),'=','');
$$
language sql
@wirekang
wirekang / md5_bytea.sql
Created November 13, 2023 01:55
Postgres text to md5 bytea function
create or replace function "md5_bytea"(text) returns bytea as
$$
select decode(md5($1), 'hex');
$$
language sql

I contributed to official NodeJS website.

In 2022, I wrote an issue about an error in the documentation. Since it was a small error, only a few words needed to be changed. I was busy then, so a random guy made a PR and merged.

BUT, a lot of time has passed, they redesign the official website (nodejs.dev -> nodejs.org). The old repository also archived, and all issues are deleted. Now nobody can access the issues.