Public vals
69
![yawnxyz avatar](https://images.clerk.dev/oauth_github/img_2NnaHhpxNuH1xWRIRjQNoo16TVc.jpeg)
sendSMS
@yawnxyz
Script
💬 Val Town Email-to-SMS Usage import { sendSMS } from 'https://esm.town/v/iamseeley/sendSMS';
sendSMS(phoneNumber: string, message: string, carrier: string): Promise<void> Parameters phoneNumber: The recipient's phone number (string of digits, no spaces or dashes) message: The text message you want to send carrier: The recipient's cell phone carrier. Supported carriers:
'att' (AT&T),
'tmobile' (T-Mobile),
'verizon' (Verizon),
'sprint' (Sprint) List of Email-To-SMS Addresses Comment on this val if you'd like me to add a carrier from the above list! Example import { sendSMS } from 'https://esm.town/v/iamseeley/sendSMS';
sendSMS('1234567890', 'Hello from Val Town!', 'verizon');
![yawnxyz avatar](https://images.clerk.dev/oauth_github/img_2NnaHhpxNuH1xWRIRjQNoo16TVc.jpeg)
sqliteExplorerApp
@yawnxyz
HTTP
SQLite Explorer View and interact with your Val Town SQLite data. It's based off Steve's excellent SQLite Admin val, adding the ability to run SQLite queries directly in the interface. This new version has a revised UI and that's heavily inspired by LibSQL Studio by invisal . This is now more an SPA, with tables, queries and results showing up on the same page. Install Install the latest stable version (v86) by forking this val: Authentication Login to your SQLite Explorer with password authentication with your Val Town API Token as the password. Todos / Plans [ ] improve error handling [ ] improve table formatting [ ] sticky table headers [x] add codemirror [ ] add loading indication to the run button (initial version shipped) [ ] add ability to favorite queries [ ] add saving of last query run for a table (started) [ ] add visible output for non-query statements [ ] add schema viewing [ ] add refresh to table list sidebar after CREATE/DROP/ALTER statements [ ] add automatic execution of initial select query on double click [x] add views to the sidebar [ ] add triggers to sidebar [ ] add upload from SQL, CSV and JSON [ ] add ability to connect to a non-val town Turso database [x] fix wonky sidebar separator height problem (thanks to @stevekrouse) [x] make result tables scrollable [x] add export to CSV, and JSON (CSV and JSON helper functions written in this val . Thanks to @pomdtr for merging the initial version!) [x] add listener for cmd+enter to submit query
![yawnxyz avatar](https://images.clerk.dev/oauth_github/img_2NnaHhpxNuH1xWRIRjQNoo16TVc.jpeg)
processTextInChunks
@yawnxyz
Script
Text Chunk Processor This JavaScript function processes long text inputs by breaking them into smaller chunks, applying a custom processing function to each chunk, and optionally handling overlaps between chunks. Function Signature processTextInChunks(inputText, processFn, config) Parameters inputText (string): The long input text to be processed. processFn (function, optional): A function to process each chunk. Defaults to logging the chunk. config (object, optional): Configuration options. Config Options chunkLength (number): Length of each chunk. Default: 1000. overlapLength (number): Length of overlap between chunks. Default: 0. Usage const longText = "Your very long text here...";
const result = processTextInChunks(longText,
(mainChunk, overlapChunk, info) => {
// Process the chunk here
console.log(`Processing chunk from ${info.startIndex} to ${info.endIndex}`);
console.log(`Main chunk: ${mainChunk}`);
console.log(`Overlap: ${overlapChunk}`);
return mainChunk.length; // Example return value
},
{
chunkLength: 500,
overlapLength: 50
}
);
console.log(result); Notes If processFn is not provided, the function will log each chunk and return the original text. If processFn returns a value, these values will be collected in an array and returned. If processFn doesn't return anything, the original input text is returned. The processFn receives three arguments: mainChunk : The current chunk of text being processed. overlapChunk : The overlapping text from the previous chunk (empty for the first chunk). An info object containing: startIndex : Start index of the current chunk in the original text. endIndex : End index of the current chunk in the original text. isLastChunk : Boolean indicating if this is the last chunk. Use Cases Processing large texts in smaller, manageable pieces. Applying transformations or analysis to text while maintaining context through overlaps. Tokenization or parsing of large documents.
![yawnxyz avatar](https://images.clerk.dev/oauth_github/img_2NnaHhpxNuH1xWRIRjQNoo16TVc.jpeg)
pipeline
@yawnxyz
Script
Using Pipeline import Pipeline from "https://esm.town/v/iamseeley/pipeline";
// ...
} else if (req.method === "POST") {
const { inputs } = await req.json();
const pipeline = new Pipeline("task", "model");
const result = await pipeline.run(inputs);
return new Response(JSON.stringify(result), { headers: { "Content-Type": "application/json" } });
}
}
exampleTranslation exampleTextClassification exampleFeatureExtraction exampleTextGeneration exampleSummarization exampleQuestionAnswering