% bun run index.ts
Inserting items: 6e340b9cffb37a98, 4bf5122f344554c5, dbc1b4c900ffe48d, 084fed08b978af4d, e52d9c508c502347, e77b9a9ae9e30b0d, 67586e98fad27da0, ca358758f6d27e6c
Are all items in the map? true
Ascending order: 084fed08b978af4d, 4bf5122f344554c5, 67586e98fad27da0, 6e340b9cffb37a98, ca358758f6d27e6c, dbc1b4c900ffe48d, e52d9c508c502347, e77b9a9ae9e30b0d
Descending order: e77b9a9ae9e30b0d, e52d9c508c502347, dbc1b4c900ffe48d, ca358758f6d27e6c, 6e340b9cffb37a98, 67586e98fad27da0, 4bf5122f344554c5, 084fed08b978af4d
Deleting item: ca358758f6d27e6c
Was the item found and deleted? true
Ascending order: 084fed08b978af4d, 4bf5122f344554c5, 67586e98fad27da0, 6e340b9cffb37a98, dbc1b4c900ffe48d, e52d9c508c502347, e77b9a9ae9e30b0d
This file contains hidden or 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 { createServerFn } from '@tanstack/start' | |
import { z } from 'zod' | |
export const withUseServer = createServerFn('GET', async function () { | |
console.log('Fetching posts...') | |
await new Promise((r) => setTimeout(r, 500)) | |
return axios | |
.get<Array<PostType>>('https://jsonplaceholder.typicode.com/posts') | |
.then((r) => r.data.slice(0, 10)) | |
}) |
This file contains hidden or 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
# syntax = docker/dockerfile:1 | |
# Adjust BUN_VERSION as desired | |
ARG BUN_VERSION=1.1.1 | |
FROM oven/bun:${BUN_VERSION}-slim as base | |
LABEL fly_launch_runtime="Next.js" | |
# Next.js app lives here | |
WORKDIR /app |
This file contains hidden or 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 { z } from "zod"; | |
import { fromZodError } from "zod-validation-error"; | |
export function procedure<TSchema extends z.ZodTypeAny = z.ZodNever>(inputSchema?: TSchema) { | |
type InputArgs = TSchema extends z.ZodNever ? [] : [z.output<TSchema>] | |
type TransformedArgs = TSchema extends z.ZodNever ? [] : [z.input<TSchema>] | |
return { | |
// eslint-disable-next-line no-unused-vars | |
do<TOutput>(fn: (...input: InputArgs) => TOutput) { |
This file contains hidden or 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
pub mod oneshot_broadcast { | |
use std::{ | |
cell::UnsafeCell, | |
pin::Pin, | |
task::{Context, Poll, Waker}, | |
}; | |
use futures_lite::Future; | |
use pin_list::PinList; | |
use pin_project_lite::pin_project; |
This file contains hidden or 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
[package] | |
name = "quic-holepunching" | |
version = "0.1.0" | |
edition = "2021" | |
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | |
[dependencies] | |
anyhow = "1.0.71" | |
bitflags = "2.2.1" |
This file contains hidden or 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
// deno run -A --unstable main.ts | |
export const classToValue = { | |
request: 0x0000, | |
indication: 0x0010, | |
success: 0x0100, | |
failure: 0x0110, | |
}; | |
export const methodToValue = { |
This file contains hidden or 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
const std = @import("std"); | |
pub fn LexicographicHashMap(comptime V: type, comptime capacity: u32) type { | |
const shift = @bitSizeOf(u64) - 1 - std.math.log2_int(u64, capacity) + 1; | |
const overflow = capacity / 10 + (@bitSizeOf(u64) - 1 - shift + 1) << 1; | |
const num_entries = capacity + overflow; | |
return struct { | |
pub const Entry = packed struct { | |
key: u32 = 0, |
This file contains hidden or 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
const std = @import("std"); | |
const sparse = @This(); | |
/// This is an implementation of a paged sparse set that stores the payload in | |
/// the sparse array. | |
// | |
/// A sparse set has a dense and a sparse array. The sparse array is directly | |
/// indexed by a 64 bit identifier. The sparse element is linked with a dense | |
/// element, which allows for liveliness checking. The liveliness check itself |
This file contains hidden or 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
const std = @import("std"); | |
pub fn main() !void { | |
const server_keys = try std.crypto.sign.Ed25519.KeyPair.create(null); | |
const client_keys = try std.crypto.sign.Ed25519.KeyPair.create(null); | |
std.log.info("server secret key: {s}", .{std.fmt.fmtSliceHexLower(&server_keys.secret_key)}); | |
std.log.info("server public key: {s}", .{std.fmt.fmtSliceHexLower(&server_keys.public_key)}); | |
std.log.info("client secret key: {s}", .{std.fmt.fmtSliceHexLower(&client_keys.secret_key)}); |
NewerOlder