fetchTwitterUserInfoBrokenmain.tsx2 matches
4import cheerio from "https://esm.sh/cheerio@1.0.0-rc.12";
56export default async function server(req: Request): Promise<Response> {
7const url = new URL(req.url);
8const formData = await req.formData().catch(() => null);
139}
140141function parseFollowerCount(followerText: string): number {
142const cleanText = followerText.replace(/,/g, '').toLowerCase();
143const num = parseFloat(cleanText);
emailListManagermain.tsx8 matches
1// This val creates a mailing list manager using blob storage for persistence.
2// It provides functions to add and remove emails, and to send emails to all subscribers.
3// The email list is stored as a JSON array in a blob.
48const BLOB_KEY = "emailListManager" + "_email_list";
910async function getEmailList(): Promise<string[]> {
11return await blob.getJSON(BLOB_KEY) || [];
12}
1314async function saveEmailList(list: string[]): Promise<void> {
15await blob.setJSON(BLOB_KEY, list);
16}
1718async function addEmail(newEmail: string): Promise<string> {
19const list = await getEmailList();
20if (!list.includes(newEmail)) {
26}
2728async function removeEmail(emailToRemove: string): Promise<string> {
29const list = await getEmailList();
30const updatedList = list.filter(email => email !== emailToRemove);
36}
3738async function sendEmailToAll(subject: string, content: string): Promise<string> {
39const list = await getEmailList();
40if (list.length === 0) {
54}
5556export default async function server(req: Request): Promise<Response> {
57const url = new URL(req.url);
58const path = url.pathname;
97// }).then(response => response.text()).then(result => console.log(result));
9899function exportCSV() {
100const emails = ${JSON.stringify(emailList)};
101const csvContent = "data:text/csv;charset=utf-8," + emails.join("\\n");
longOliveGuppymain.tsx3 matches
7import { createRoot } from "https://esm.sh/react-dom/client";
89function App() {
10const [messages, setMessages] = useState([]);
11const [input, setInput] = useState("");
60}
6162function client() {
63createRoot(document.getElementById("root")).render(<App />);
64}
65if (typeof document !== "undefined") { client(); }
6667async function server(request: Request): Promise<Response> {
68const Cerebras = await import("https://esm.sh/@cerebras/cerebras_cloud_sdk");
69const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
iangac_validatormain.tsx1 match
4const app = new Hono();
56function analyzeJSON(jsonData) {
7const images = jsonData.images;
8const allIds = new Set(images.map(img => img.id));
globalIncrementmain.tsx6 matches
1// This val uses Val Town's Blob storage to maintain a shared global integer value.
2// We'll use the val's URL as the storage key for consistency.
3// The main function handles both GET requests to retrieve the current value
4// and POST requests to increment the value.
5// We're using Promises with .then() instead of async/await for asynchronous operations.
10const KEY = "Ben Wheeler globalIncrement test key";
1112export function getValue(): Promise<number> {
13return blob.getJSON(KEY)
14.then(value => typeof value === "number" ? value : 0)
16}
1718export function increment(): Promise<number> {
19return getValue()
20.then(currentValue => {
28}
2930export default async function(req: Request): Promise<Response> {
31if (req.method === "POST") {
32return increment()
39}
4041export function checkIfWorking(req: Request): Promise<Response> {
42console.log("working");
43}
4445// export function main(req: Request): Promise<Response> {
46// }
3132// ------------
33// Functions
34// ------------
3536async function execute(statement: InStatement, args?: InArgs): Promise<ResultSet> {
37const res = await fetch(`${API_URL}/v1/sqlite/execute`, {
38method: "POST",
49}
5051async function batch(statements: InStatement[], mode?: TransactionMode): Promise<ResultSet[]> {
52const res = await fetch(`${API_URL}/v1/sqlite/batch`, {
53method: "POST",
64}
6566function createResError(body: string) {
67try {
68const e = zLibsqlError.parse(JSON.parse(body));
85}
8687function normalizeStatement(statement: InStatement, args?: InArgs) {
88if (Array.isArray(statement)) {
89// for the case of an array of arrays
107}
108109function upgradeResultSet(results: ImpoverishedResultSet): ResultSet {
110return {
111...results,
116// adapted from
117// https://github.com/tursodatabase/libsql-client-ts/blob/17dd996b840c950dd22b871adfe4ba0eb4a5ead3/packages/libsql-client/src/sqlite3.ts#L314C1-L337C2
118function rowFromSql(
119sqlRow: Array<unknown>,
120columns: Array<string>,
11`);
1213export default async function(req: Request): Promise<Response> {
14const res = await db.query(`
15UPDATE test
10type GeneratedImage = { imageUrl: string; prompt: string };
1112function App() {
13const [prompt, setPrompt] = useState("");
14const [imageUrl, setImageUrl] = useState("");
92}
9394function client() {
95createRoot(document.getElementById("root")).render(<App />);
96}
100}
101102export default async function server(request: Request): Promise<Response> {
103const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
104const url = new URL(request.url);