Search

myApi
@javi
An interactive, runnable TypeScript val by javi
Script
export function myApi(name) {
return "hi " + name;

valToModule
@easrng
An interactive, runnable TypeScript val by easrng
Express (deprecated)
export async function valToModule(req: express.Request, res: express.Response) {
try {
const { transpileVal } = await import(
myApi
@max
An interactive, runnable TypeScript val by max
Script
export function myApi(name) {
return "hi " + name;

myApi
@caseywoolley
An interactive, runnable TypeScript val by caseywoolley
Script
export function myApi(name, welcome) {
return "hi " + name + `, ${welcome}`;

callMe
@kos0616
An interactive, runnable TypeScript val by kos0616
Script
let { count } = await import("https://esm.town/v/kos0616/count");
import { sendMsgToDiscord } from "https://esm.town/v/kos0616/sendMsgToDiscord";
export async function callMe(msg: string) {
try {
await sendMsgToDiscord(msg);
surfboardDemoSchedule2
@szymonator
// WELCOME TO THE API DEMO
HTTP
// DO NOT EDIT
async function getSchedule() {
try {
return null;
function Demo({ data }) {
if (!data) return <p>Failed to fetch</p>;
function processData(data) {
/*console.log(JSON.stringify(data,null,2))*/
// hydrateRoot(document, <App data={scheduleData} />);
export default async function(req: Request): Promise<Response> {
const scheduleData = await getSchedule();
script_6sbfbg98wajm0b51pjunnu2pwj8nbi98
@zrw
An interactive, runnable TypeScript val by zrw
Script
export const script_6sbfbg98wajm0b51pjunnu2pwj8nbi98 = (async function() {
const rosters = {
"Zack": ["PHI", "WSH", "IND", "TB", "LAR", "TEN", "HOU"],
myApi
@DateMaps
An interactive, runnable TypeScript val by DateMaps
Script
export function myApi(name) {
return "hi " + name;
gemini_coder
@awhitter
This is an AI code assistant powered by Cerebras , running llama3.3-70b. Inspired by Hassan's Llama Coder . Setup Sign up for Cerebras Get a Cerebras API Key Save it in a Val Town environment variable called CEREBRAS_API_KEY Todos I'm looking for collaborators to help. Fork & send me PRs! [ ] Experiment with two prompt chain (started here )
HTTP
</a>
function Hero({
prompt,
</section>
function App() {
const [prompt, setPrompt] = useState("");
</div>
function client() {
createRoot(document.getElementById("root")).render(<App />);
if (typeof document !== "undefined") { client(); }
export default async function content_marketing_mastery(req: Request): Promise<Response> {
const KEY = "content_marketing_mastery";
handleDiscordInteraction
@jamisonl
Bot for Cama discord server. To initialize new slash commands, you have to run a separate bit of code. This is for modifying their functionality
HTTP
Bot for Cama discord server. To initialize new slash commands, you have to run a separate bit of code. This is for modifying their functionality
req.headers.get("X-Signature-Ed25519"),
req.headers.get("X-Signature-Timestamp"),
// Get the user calling this slash command
const userId = await body.member?.user?.id;
if (bank[userId] === undefined) bank[userId] = starting_amount;
val_1mTgERX3iy
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export default async function handler(req) {
try {
const result = await (async () => {
linearRegression
@bao
@jsxImportSource https://esm.sh/react@18.2.0
HTTP
import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
function linearRegression(x: number[], y: number[]) {
const n = x.length;
return { slope, intercept };
function App() {
const [inputData, setInputData] = 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(`
duckdbExample
@tmcw
DuckDB DuckDB works on Val Town, with only one small tweak! We're basically using DuckDB in the same way you'd use it with a browser - using the WASM package with its dependencies fetched from jsdelivr . The only trick is to create the worker ourselves rather than using duckdb.createWorker . DuckDB's built-in createWorker method doesn't specify a worker type, which causes type to default to classic , and Deno (our runtime) doesn't support classic workers.
Script
import { fetch } from "https://esm.town/v/std/fetch";
export let duckdbExample = (async () => {
async function createWorker(url: string) {
const workerScript = await fetch(url);
const workerURL = URL.createObjectURL(await workerScript.blob());
helloWorld
@campsite
This is a simple script to create a post on Campsite. Use it as a starting point for other scripts. Campsite API Documentation: https://campsite.com/docs
Script
const CONTENT = `Hello world`;
const CHANNEL_ID = "<project_id>";
async function main() {
const body = {
title: "Hello World",
EquityCalculator
@bheemanadam
@jsxImportSource https://esm.sh/react@18.2.0
HTTP
annualDividend: 2.5,
function FinancialCalculator() {
const [darkMode, setDarkMode] = useState(false);
const [error, setError] = useState(null);
// Reset function
const resetCalculator = () => {
</div>
function client() {
createRoot(document.getElementById("root")).render(<FinancialCalculator />);
if (typeof document !== "undefined") { client(); }
export default async function server(request: Request) {
return new Response(