pollRSSFeedsmain.tsx1 match
3import { newRSSItems } from "https://esm.town/v/stevekrouse/newRSSItems";
45export async function pollRSSFeeds({ lastRunAt }: Interval) {
6return Promise.all(
7Object.entries(rssFeeds).map(async ([name, url]) => {
linkInBioTemplatemain.tsx1 match
2import { renderToString } from "npm:react-dom/server";
34export default async function(req: Request) {
5return new Response(
6renderToString(
databaseRunnermain.tsx7 matches
22const MAX_ROWS_PER_CHUNK = 10000;
2324export default async function(req: Request): Promise<Response> {
25console.log("Received request");
26let requestBody: QueryRequest;
99}
100101async function executePostgresQuery(url: string, query: string): Promise<any[]> {
102console.log("Connecting to PostgreSQL");
103const client = new pg.Client({
136}
137138async function executeMysqlQuery(url: string, query: string): Promise<any[]> {
139console.log("Connecting to MySQL");
140const connection = await mysql.createConnection(url);
163}
164165async function introspectPostgresSchema(url: string): Promise<any[]> {
166const query = `
167SELECT
181}
182183async function introspectMysqlSchema(url: string): Promise<any[]> {
184const query = `
185SELECT
199}
200201function splitIntoChunks(results: any[], maxRowsPerChunk: number): any[][] {
202console.log(`Splitting ${results.length} rows into chunks of ${maxRowsPerChunk}`);
203const chunks = [];
209}
210211async function createGzipFile(chunk: any[], index: number, shouldGzip: boolean, introspection: boolean): Promise<any> {
212console.log(`Creating ${shouldGzip ? "gzip" : ""} file for chunk ${index + 1}`);
213const csv = parse(chunk);
multiplayerCirclesmain.tsx6 matches
37// });
3839function parseResultSet<T>(row: ResultSet): T[] {
40return row.rows.map((r) => Object.fromEntries(r.map((c, i) => [row.columns[i], c]))) as T[];
41}
51};
5253function diffCircles(array1: Circle[], array2: Circle[]): Circle[] {
54const changes: Circle[] = [];
557475const drag = (() => {
76function dragstarted() {
77d3.select(this).attr("stroke", "black");
78}
7980function dragged(event, d) {
81d3.select(this).raise().attr("cx", d.x = event.x).attr("cy", d.y = event.y);
82}
8384function dragended() {
85const x = d3.select(this).attr("cx");
86const y = d3.select(this).attr("cy");
105.call(drag)
106.on("click", clicked);
107function clicked(event, d) {
108if (event.defaultPrevented) return; // dragged
109
SolanaJupiterSwapEventParsermain.tsx4 matches
11`);
1213export function publicKey(data: Uint8Array, offset: number) {
14return base58.encode(data.subarray(offset, offset + 32));
15}
1617export function u64(view: DataView, offset: number) {
18return view.getBigUint64(offset, true);
19}
2021export function parseSwapEvent(data: Uint8Array) {
22const view = new DataView(data.buffer, data.byteOffset, data.byteLength);
23return {
32console.log(parseSwapEvent(input));
3334function bytes(str: string): Uint8Array {
35return base16.decode(str.replaceAll(/\s/g, "").toUpperCase());
36}
1import { email } from "https://esm.town/v/std/email?v=11";
23export function forwarder(e: {
4from: string;
5to: string[];
socialMetaTestmain.tsx1 match
2import { renderToString } from "npm:react-dom/server";
34export default async function(req: Request) {
5const description = "social meta test";
6const title = "JGB Test";
57### Utilities
5859Our Blob SDK also includes some utility functions to make working with blobs easier.
6061##### Copy
45/**
6* Provides functions for interacting with your account's blob storage.
7* Blobs can store any data type (text, JSON, images, etc.) and allow
8* retrieval across different vals using the same key.
80};
8182async function list(prefix?: string): Promise<{ key: string; size: number; lastModified: string }[]> {
83let querystring = prefix ? `?prefix=${encodeURIComponent(prefix)}` : "";
84const res = await fetch(`${API_URL}/v1/blob${querystring}`, {
94}
9596async function delete_(key: string) {
97const res = await fetch(`${API_URL}/v1/blob/${encodeURIComponent(key)}`, {
98method: "DELETE",
107}
108109async function get(key: string) {
110const res = await fetch(`${API_URL}/v1/blob/${encodeURIComponent(key)}`, {
111headers: {
123}
124125async function set(key: string, value: BodyInit) {
126const res = await fetch(`${API_URL}/v1/blob/${encodeURIComponent(key)}`, {
127method: "POST",
137}
138139async function copy(previous: string, next: string) {
140const res = await get(previous);
141await set(next, res.body);
142}
143144async function move(previous: string, next: string) {
145await copy(previous, next);
146await delete_(previous);
147}
148149async function getJSON(key: string) {
150try {
151const res = await get(key);
159}
160161async function setJSON(key: string, value: any) {
162return set(key, JSON.stringify(value));
163}
dubLinksUpsertmain.tsx1 match
6});
78export default async function(req: Request): Promise<Response> {
9const { shortLink } = await dub.links.upsert({
10url: "https://www.val.town/v/steventey/dubLinksUpsert",