OS: Ubuntu 24.04.2 LTS aarch64
Host: VMware20,1 1
Kernel: 6.8.0-53-generic
CPU: Apple M2 Pro
GPU: Apple M2 Pro
postgres=# EXPLAIN ANALYSE SELECT generate_ulid() FROM generate_series(1, 10000000);
OS: Ubuntu 24.04.2 LTS aarch64
Host: VMware20,1 1
Kernel: 6.8.0-53-generic
CPU: Apple M2 Pro
GPU: Apple M2 Pro
postgres=# EXPLAIN ANALYSE SELECT generate_ulid() FROM generate_series(1, 10000000);
/** | |
* Uses various heurisitics to determine if an error is a connection error. | |
*/ | |
export function isConnectionError(err: unknown): boolean { | |
if (typeof err !== "object" || err == null) { | |
return false; | |
} | |
// Covers fetch in Deno as well | |
const isBrowserErr = |
// Chromium bug: https://issues.chromium.org/issues/40450316 | |
const headers = new Headers(); | |
headers.set("user-agent", "fancy/1.0"); | |
console.log(headers.get("user-agent") == null); | |
// Prints: false | |
const req = new Request(''); | |
req.headers.set("user-agent", "fancy/1.0"); | |
console.log(req.headers.get("user-agent") == null); |
export function tryParseURL(input: unknown): URL | null { | |
if (input instanceof URL) { | |
return input; | |
} | |
if (typeof input !== "string") { | |
return null; | |
} | |
try { | |
return new URL(input); |
package log | |
import ( | |
"context" | |
"log/slog" | |
) | |
// A DiscardHandler discards all log records. | |
type DiscardHandler struct{} |
package main | |
import ( | |
"errors" | |
"fmt" | |
"runtime" | |
) | |
func Assert(group string, pairs ...any) error { | |
if len(pairs)%2 != 0 { |
function logGroup(label: string) { | |
console.group(label) | |
return { | |
[Symbol.dispose]: () => { | |
console.groupEnd() | |
} | |
} | |
} | |
function demo() { |
package functional | |
import ( | |
"context" | |
"errors" | |
"time" | |
"github.com/benthosdev/benthos/v4/public/service" | |
) |
// This is untested code. More of a proof of concept for what's to come... | |
async function $acquire< | |
Resource | |
>(fn: () => Promise<readonly [resource: Resource, teadown?: () => void]>) { | |
let [resource, teardown = () => {}] = await fn(); | |
return { | |
resource, | |
[Symbol.dispose]: teardown, | |
} |
package debounce | |
import ( | |
"context" | |
"errors" | |
"fmt" | |
"sync" | |
"time" | |
) |