Search
val_9FQ5lTRDXf
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export async function val_9FQ5lTRDXf(req) {
try {
// Execute the code directly and capture its result
doit
@maksik
An interactive, runnable TypeScript val by maksik
Script
export async function doit() {
console.email("Hello!", "from Val Town");
val_hhGpnm1tf9
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export async function val_hhGpnm1tf9(req) {
function generateAllProblems() {
"Implement a function to find the missing number in an array of 1 to N",
"Write a function to rotate an array by k positions",
"Create a function to merge two sorted arrays",
"Implement a function to find the longest increasing subsequence",
"Write a function to find pairs in array with sum equal to target"
"Write a function to find the longest palindromic substring",
"Implement a function to check if two strings are anagrams",
"Create a function to find the first non-repeating character",
myApi
@tonycheal
An interactive, runnable TypeScript val by tonycheal
Script
export function myApi(name) {
return "hi " + name;
myApi
@ctalke
An interactive, runnable TypeScript val by ctalke
Script
export function myApi(name) {
return "hi " + name;
val_JhxcurPkrD
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export async function val_JhxcurPkrD(req) {
try {
// Execute the code directly and capture its result
webassemblyExample
@mkeller7
An interactive, runnable TypeScript val by mkeller7
Script
const importObj = {};
const { instance } = await WebAssembly.instantiate(source.buffer, importObj);
const addTwo = instance.exports.addTwo as CallableFunction;
return addTwo(2, 3);
myApi
@norriswu0
An interactive, runnable TypeScript val by norriswu0
Script
export function myApi(name) {
return "hi " + name;
myApi
@ndom91
An interactive, runnable TypeScript val by ndom91
Script
export function myApi(name) {
return "hi " + name;
whatsThatAgainInHotDogs
@dthyresson
A Townie remake of https://www.val.town/v/dthyresson/whatsThatInHotDogs
HTTP
<script>
function calculateHotdogs() {
const playerName = document.getElementById('playerSelect').value;
highlightRow(row);
function highlightRow(row) {
// Clear previous highlights
hotdogs: hotdogs
export default async function handler(request: Request): Promise<Response> {
return app.fetch(request)
pythonHTTPVal
@iamseeley
pyodide 🤝 deno trick pyodide to execute python code in the deno runtime deno module source: py-town not all python packages are supported by pyodide
HTTP
import { runPythonCode } from "https://deno.land/x/py_town@v0.0.8/mod.ts";
export default async function handler(req: Request): Promise<Response> {
const pythonCode = `
import numpy as np
smsjournalertextrelay
@cephalization
* This val creates a webhook endpoint that receives text messages and sends SMS replies using the TextBelt API.
* It uses blob storage to keep track of message history and conversation state.
* The TextBelt API is used for sending SMS messages without requiring an API key.
* The conversation history is stored as an array of message objects containing sender, content, date, and phone number.
* OpenAI's GPT-4 is used to generate contextual responses based on the conversation history.
HTTP
* OpenAI's GPT-4 is used to generate contextual responses based on the conversation history.
import { OpenAI } from "https://esm.town/v/std/openai";
function validateTextbeltRequestSignature(
// Helper function to send SMS using TextBelt API
async function sendSMS(phone: string, message: string) {
// Helper function to get conversation history
async function getConversationHistory(phone: string): Promise<Message[]> {
// Helper function to update conversation history
async function updateConversationHistory(phone: string, message: Message) {
// Helper function to generate AI response
resumeRecs
@iamseeley
An interactive, runnable TypeScript val by iamseeley
Script
import { TokenBucket } from "https://esm.town/v/iamseeley/tokenBucket";
const tokenBucket = new TokenBucket(5, 1/12);
export async function getRecommendations(jobDescription, resume, apiKey) {
if (!tokenBucket.consume()) {
throw new Error("Rate limit reached. Please try again later.");
const endpoint = 'https://api.openai.com/v1/chat/completions';
const model = 'gpt-4';
const messages = [