Search

Results include substring matches and semantically similar vals. Learn more
ypx avatar
myApi
@ypx
An interactive, runnable TypeScript val by ypx
Script
export function myApi(name) {
return "hi " + name;
mrshorts avatar
codeLearnerProApp
@mrshorts
@jsxImportSource https://esm.sh/react@18.2.0
HTTP
# Decorators
def log_function(func):
def wrapper(*args, **kwargs):
print(f"Calling {func.__name__}")
return func(*args, **kwargs)
return wrapper
@log_function
def example_function():
pass
function App() {
const [activeSection, setActiveSection] = useState('python');
textDecoration: 'none'
function client() {
createRoot(document.getElementById("root")).render(<App />);
if (typeof document !== "undefined") { client(); }
export default async function server(request: Request): Promise<Response> {
return new Response(`
dhvanil avatar
val_x1FBmxv9sD
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export async function val_x1FBmxv9sD(req) {
try {
// Execute the code directly and capture its result
eric avatar
oneify
@eric
An interactive, runnable TypeScript val by eric
Script
let { definitelynotnull } = await import("https://esm.town/v/eric/definitelynotnull");
export function oneify() {
return definitelynotnull = 1
stevekrouse avatar
date_me_doc_helpers
@stevekrouse
An interactive, runnable TypeScript val by stevekrouse
Script
export function parseNotionDateDoc(obj): DateMeDoc {
return {
Id: obj.id,
toowired avatar
bubblyMaroonLungfish
@toowired
// Test starting a new goal
Script
return { success: false, error: error.message };
// Export for Val Town
export async function test(args) {
return await runTests();
stevekrouse avatar
sqlite
@stevekrouse
LLM-Safe Fork of @std/sqlite We found that LLMs have trouble with the inputs and outputs of our @std/sqlite method. It expects the input to be (sql: string, args: any[]) but it's { sql: string, args: any[] } It expects the output to be objects, but they are arrays Instead of struggling to teach it, we built this val to be a wrapper around @std/sqlite that adheres to what the LLMs expect. This val is also backwards-compatible with @std/sqlite, so we're considering merging it in.
Script
batch,
// Functions
async function execute(statement: InStatement, args?: InArgs): Promise<ResultSet> {
const res = await fetch(`${API_URL}/v1/sqlite/execute`, {
return upgradeResultSet(resultSet);
async function batch(statements: InStatement[], mode?: TransactionMode): Promise<ResultSet[]> {
if (mode && !["write", "read", "deferred"].includes(mode)) {
return resultSets.map(upgradeResultSet);
function createResError(body: string) {
try {
rows: any[];
function normalizeStatement(statement: InStatement, args?: InArgs) {
if (Array.isArray(statement)) {
else throw new Error("Error normalizing sql input");
function upgradeResultSet(results: ImpoverishedResultSet): ResultSet {
return {
// https://github.com/tursodatabase/libsql-client-ts/blob/17dd996b840c950dd22b871adfe4ba0eb4a5ead3/packages/libsql-client/src
function rowFromSql(
sqlRow: Array<unknown>,
abizer avatar
smac_quote_gen
@abizer
generate a random quote in the style of sid meier's alpha centauri
HTTP
The length of your quote should depend on the context of the topic, but in general, should not exceed 20-80 words.
Please provide your Alpha Centauri-style quote with the quote and the attribution, in simple HTML markup with the lines and s
export default async function server(request: Request): Promise<Response> {
const url = new URL(request.url);
const prompt = url.searchParams.get("prompt");
headers: { "Content-Type": "text/html" },
} catch (error) {
console.error("Error calling Anthropic API:", error);
return new Response("Error generating completion. Please try again later.", { status: 500 });
yejun avatar
bbrun
@yejun
A simple chat app harness for your board Provides a very simple chat app UI for a Breadboard board. For now, requires you to be running a board server. This harness actually acts as a proxy to the board server run API endpoint , and puts a nice (well, somewhat nice) frontend on top of it. The frontend is somewhat limited in what it can show, currently supporting only LLMContent and array of LLMContent outputs, and only LLMContent array input. The script will look for the BB_LIVE_KEY in your Val Town environment, which must contain your board server API key. To use, create an HTTP val, then import the proxy function from this script and call it like this: import { proxy } from "https://esm.town/v/dglazkov/bbrun"; export default proxy( "url-to-the-board.bgl.json", );
Script
must contain your board server API key.
To use, create an HTTP val, then import the `proxy` function from this script and call it like this:
```ts
const DEFAULT_FRONTEND_MODULE = "https://esm.town/v/yejun/bbrun";
* You can supply these options as a second argument to the `proxy` function.
* These options are used to configure the frontend.
export const proxy = (url: string, options?: FrontendOptions) => {
return async function(req: Request): Promise<Response> {
if (req.method === "GET") {
saolsen avatar
lucia_hono
@saolsen
// deno-lint-ignore-file no-namespace
HTTP
.length(27)
.transform((k: string) => k as UserId);
export function userId(): UserId {
return `u_${Uuid25.fromBytes(uuidv7obj().bytes).value}` as UserId;
export const users = sqliteTable(`${KEY}_users`, {
app.route("/", web.app);
await migrate(sqlite, schema.KEY, schema.MIGRATIONS);
export default async function handler(
req: Request,
): Promise<Response> {
janpaul123 avatar
valle_tmp_5930671456461067316376022226166
@janpaul123
// This val will respond to HTTP requests with "Hello, World!"
HTTP
// This val will respond to HTTP requests with "Hello, World!"
export default async function (req: Request): Promise<Response> {
return new Response("Hello, World!", { headers: { "Content-Type": "text/plain" } });
konradmoneta avatar
carInventory
@konradmoneta
@jsxImportSource https://esm.sh/react
HTTP
const APP_ID = "5518c0f9-481c-4aa8-85cd-eee42bd45319";
function CarWindow({ car, onSave, onClose, title }) {
const [make, setMake] = useState(car?.make || "");
</div>
function App() {
const [cars, setCars] = useState([]);
</div>
function client() {
console.log("Client function called");
const root = document.getElementById("root");
if (typeof document !== "undefined") {
console.log("Document is defined, calling client function");
client();
console.log("Document is undefined, skipping client-side rendering");
async function server(request: Request): Promise<Response> {
console.log("Server function called");
return new Response(
adnanwahab avatar
blobReadPictureExample
@adnanwahab
Browserbase Browserbase offers a reliable, high performance serverless developer platform to run, manage, and monitor headless browsers at scale. Leverage our infrastructure to power your web automation and AI agents. Get started with Browserbase for free here . If you have any questions, reach out to developer@browserbase.com.
HTTP
export default async function handler(request: Request): Promise<Response> {
const searchParams = new URL(request.url).searchParams;
const url = searchParams.get("url") || "https://www.browserbase.com";
youkq95 avatar
PaintSeq
@youkq95
@jsxImportSource https://esm.sh/react
HTTP
return composition;
function GroupConfigModal({
groups,
</div>
function App() {
const [sequence, setSequence] = useState("");
</div>
function client() {
createRoot(document.getElementById("root")).render(<App />);
if (typeof document !== "undefined") { client(); }
export default async function server(request: Request): Promise<Response> {
return new Response(
vawogbemi avatar
instantdbCursorsDemo
@vawogbemi
@jsxImportSource https://esm.sh/react
HTTP
"flex h-screen w-screen items-center justify-center overflow-hidden font-mono text-sm text-gray-800 touch-none";
function InstantCursorsProvider(props: { children: JSX.Element }) {
const db = init({
{props.children}
function App() {
return (
</div>
function client() {
createRoot(document.getElementById("root")).render(
client();
export default async function server(request: Request): Promise<Response> {
return new Response(