Search

Results include substring matches and semantically similar vals. Learn more
timoc avatar
myApi
@timoc
An interactive, runnable TypeScript val by timoc
Script
export function myApi(name) {
return "hi " + name;
andreterron avatar
searchPostsForTheActuallyBot
@andreterron
An interactive, runnable TypeScript val by andreterron
Script
import { searchTweets } from "https://esm.town/v/andreterron/searchTweets";
export async function searchPostsForTheActuallyBot(accessToken: string): Promise<{
id: string;
text: string;
andreterron avatar
pocket
@andreterron
An interactive, runnable TypeScript val by andreterron
Script
export function pocket() {
return {
hello: () => { return 'hi there' }
cai avatar
aqi
@cai
AQI Alerts Get email alerts when AQI is unhealthy near you. Set up Click Fork Change location (Line 4) to describe your location. It accepts fairly flexible English descriptions which it turns into locations via nominatim's geocoder API . Click Run Background This val uses nominatim's geocoder to get your lat, lon, and air quality data from OpenAQ. It uses EPA's NowCast AQI Index calculation and severity levels. Learn more: https://www.val.town/v/stevekrouse.easyAQI
Cron
import { email } from "https://esm.town/v/std/email?v=9";
import { easyAQI } from "https://esm.town/v/stevekrouse/easyAQI?v=5";
export async function aqi(interval: Interval) {
const location = "salt lake city"; // <-- change to place, city, or zip code
const data = await easyAQI({ location });
rozek avatar
GDI_HelloWorld
@rozek
This val is part of a series of examples to introduce "val.town" in my computer science course at Stuttgart University of Applied Sciences . The idea is to motivate even first-semester students not to wait but to put their ideas into practice from the very beginning and implement web apps with frontend and backend. It contains a very simple (but still a bit visually impressive) "Hello, World!" web page made with Townie. This val is licensed under the MIT License.
HTTP
import { createRoot } from "https://esm.sh/react-dom/client";
function App() {
return (
</div>
function client() {
const root = document.getElementById('root');
client();
export default async function server(request: Request): Promise<Response> {
return new Response(`
Danap avatar
cerebras_coder
@Danap
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
HTTP
import { STARTER_PROMPTS } from "https://esm.town/v/stevekrouse/cerebras_coder_prompts";
function extractCodeFromFence(content: string): string {
const codeMatch = content.match(/```html\n([\s\S]*?)```/);
return codeMatch ? codeMatch[1].trim() : content.trim();
async function generateCode(prompt: string, currentCode: string) {
const starterPrompt = STARTER_PROMPTS.find(p => p.prompt === prompt);
totalTokens: completion.usage?.completion_tokens || 1,
function App() {
const [prompt, setPrompt] = useState('');
</div>
function client() {
// Add Tailwind CSS for styling
if (typeof document !== "undefined") { client(); }
export default async function server(request: Request): Promise<Response> {
if (request.method === 'POST' && new URL(request.url).pathname === '/generate') {
codefromanywhere avatar
amusedAquaHeron
@codefromanywhere
An interactive, runnable TypeScript val by codefromanywhere
HTTP
export default async function handler(request: Request) {
if (request.method !== "POST") {
return Response.json({ message: "This val responds to POST requests." }, {
rasputinkaiser avatar
linkInBioTemplate
@rasputinkaiser
@jsxImportSource https://esm.sh/react
HTTP
// ... (previous AuthContext, AuthProvider, and useAuth remain the same)
function App() {
// ... (App component remains the same)
function Home({ theme }) {
const { user } = useAuth();
</div>
function PromptGenerator() {
const [prompt, setPrompt] = useState('');
</div>
function Tools({ theme }) {
const isDark = theme === 'dark';
</div>
function Gallery({ theme }) {
const isDark = theme === 'dark';
fontStyle: 'italic',
// ... (client and server functions remain the same)
dhvanil avatar
val_WzWC3no9LW
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export async function val_WzWC3no9LW(req) {
try {
// Execute the code directly and capture its result
janpaul123 avatar
valle_tmp_0114941516041842115534002538246594
@janpaul123
// This val responds with "Hello, world!"
HTTP
// This val responds with "Hello, world!"
export default async function(req: Request): Promise<Response> {
return new Response("Hello, world!");
adagradschool avatar
claude_a17f63b5_0c2b_4964_9a77_9229fece4c33
@adagradschool
An interactive, runnable TypeScript val by adagradschool
HTTP
export default function handler(req) {
return new Response(`"\n <!DOCTYPE html>\n <html>\n <head>\n <title>Claude Chat Conversation</title
headers: {
turbo1912 avatar
fal_sdxl
@turbo1912
fal/sdxl This val is an example usage sdxl with fal.ai's javascript client. https://www.fal.ai/models/stable-diffusion-xl The client offers a way for you to subscribe to queue updates. This is useful if you want to get notified when a function is done running, or if you want to get the logs as they are being generated. import fal from "npm:@fal-ai/serverless-client"; const result = await fal.subscribe(FUNCTION_ID, { input: { seed: 176400, }, pollInterval: 5000, logs: true, onQueueUpdate: (update) => { console.log(update.status); if (update.status === "IN_PROGRESS") { update.logs.map((log) => log.message).forEach(console.log); } }, }); console.log(result.url); The onQueueUpdate callback will be called every time the queue status changes. The update object contains the queue status data as documented on the status types section .
Script
https://www.fal.ai/models/stable-diffusion-xl
bscribe to queue updates. This is useful if you want to get notified when a function is done running, or if you want to get t
```js
import fal from "npm:@fal-ai/serverless-client";
const result = await fal.subscribe(FUNCTION_ID, {
input: {
bladesquad avatar
expositionAgencyPage
@bladesquad
@jsxImportSource https://esm.sh/react
HTTP
[key: string]: string | null;
function ExpolineParticipationForm() {
const [step, setStep] = useState(0);
</div>
function client() {
createRoot(document.getElementById("root")).render(<ExpolineParticipationForm />);
width: 100%;
export default async function server(request: Request): Promise<Response> {
return new Response(`
dhvanil avatar
val_n8RHhxGCyM
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export async function val_n8RHhxGCyM(req) {
try {
// Execute the code directly and capture its result
scottmcclung avatar
myApi
@scottmcclung
An interactive, runnable TypeScript val by scottmcclung
Script
export function myApi(name) {
return "hi " + name;