Search

Results include substring matches and semantically similar vals. Learn more
dhvanil avatar
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
maksik avatar
doit
@maksik
An interactive, runnable TypeScript val by maksik
Script
export async function doit() {
console.email("Hello!", "from Val Town");
dhvanil avatar
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",
tonycheal avatar
myApi
@tonycheal
An interactive, runnable TypeScript val by tonycheal
Script
export function myApi(name) {
return "hi " + name;
ctalke avatar
myApi
@ctalke
An interactive, runnable TypeScript val by ctalke
Script
export function myApi(name) {
return "hi " + name;
dhvanil avatar
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
mkeller7 avatar
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);
norriswu0 avatar
myApi
@norriswu0
An interactive, runnable TypeScript val by norriswu0
Script
export function myApi(name) {
return "hi " + name;
ndom91 avatar
myApi
@ndom91
An interactive, runnable TypeScript val by ndom91
Script
export function myApi(name) {
return "hi " + name;
dthyresson avatar
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)
iamseeley avatar
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
cephalization avatar
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
iamseeley avatar
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 = [
ccallaway93 avatar
test
@ccallaway93
An interactive, runnable TypeScript val by ccallaway93
Script
export async function test() {
const { default: axios } = await import("npm:axios");
const url = "http://207.244.232.58:8011/api/login";
dhvanil avatar
val_v3yQtMfxD6
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export async function val_v3yQtMfxD6(req) {
try {
// Execute the code directly and capture its result