Search

Results include substring matches and semantically similar vals. Learn more
stevekrouse avatar
cron2
@stevekrouse
@jsxImportSource npm:hono@3/jsx
HTTP
/** @jsxImportSource npm:hono@3/jsx */
const app = new Hono();
export default app.fetch;
app.get("/", async (c) => {
const description = c.req.query("description") || "On weekdays at noon";
const timezone = c.req.query("timezone") || "America/New_York";
const cron = c.req.query("description") ? await compile(description, timezone) : "0 16 * * 1-5";
let translated;
try {
translated = cronstrue.toString(cron, { tzOffset: getOffset(timezone), use24HourTimeFormat: false });
stevekrouse avatar
evalPost2
@stevekrouse
An interactive, runnable TypeScript val by stevekrouse
Script
import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
export let evalPost2 = fetchJSON(
"https://api.val.town/v1/eval",
method: "POST",
body: JSON.stringify({ code: "(a,b) => a+b", args: [1, 2] }),
kognise avatar
onValenceReply
@kognise
An interactive, runnable TypeScript val by kognise
Script
export async function onValenceReply(email) {
const firstNumber = parseInt(email.text.trim(), 10)
try {
await addValenceDatapoint(firstNumber)
await mail({
to: "Lexi Mattick <lexi.mattick@gmail.com>",
from: "Valence Tracker <kognise.onValenceReply@valtown.email>",
subject: `Re: ${email.subject}`,
text: 'received and stored! thanks.'
} catch (error) {
tjak avatar
blimpy
@tjak
An interactive, runnable TypeScript val by tjak
HTTP
export let blimpy = async (request: Request): Promise<Response> => {
return new Response("blimpy", { headers: { "x-blimpy": "blimpy" } });
browserbase avatar
httpApiScreenshotPageExample
@browserbase
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
### Browserbase
Browserbase offers a reliable, high performance serverless developer platform to run, manage, and monitor headless browsers a
Get started with Browserbase for free [here](browserbase.com).
If you have any questions, reach out to developer@browserbase.com.
export async function blobReadPictureExample(request: Request): Promise<Response> {
const searchParams = new URL(request.url).searchParams;
const url = searchParams.get("url") || "https://www.browserbase.com";
const buffer = await screenshotPage(url);
console.log(url);
const img = await Jimp.read(Buffer.from(buffer.buffer));
kora avatar
gemini
@kora
When use, just import { flash } from "./gemini"
Script
When use, just
```ts
import { flash } from "./gemini"
import { GoogleGenerativeAI } from "https://esm.run/@google/generative-ai";
const genAI = new GoogleGenerativeAI(Deno.env.get("GEMINI_API_KEY"));
export const flash = genAI.getGenerativeModel({ model: "gemini-1.5-flash" });
export const g2 = genAI.getGenerativeModel({ model: "gemini-exp-1114" });
// const prompt = "สวัสดีจ้า";
// const result = await model.generateContent(prompt);
// console.log(result.response.text());
zhima avatar
tell2
@zhima
// Store messages via SQLite
Script
let { messages2 } = await import("https://esm.town/v/zhima/messages2");
// Store messages via SQLite
// (stores at @me.messages2 in the current version)
// like `https://www.val.town/@stevekrouse.tell` but cooler!
export const tell2 = async (msg) => {
const { DB } = await import("https://deno.land/x/sqlite/mod.ts");
const db = new DB();
// Get existing messages (if any)
if (messages2 !== undefined) {
db.deserialize(messages2);
dhvanil avatar
val_l2wsc3RTY0
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export default async function handler(req) {
try {
const result = await (async () => {
function isPrime(num) {
if (num <= 1) return false;
for (let i = 2; i <= Math.sqrt(num); i++) {
if (num % i === 0) return false;
return true;
function findLowestThreeDigitPrime() {
for (let num = 100; num < 1000; num++) {
cwervo avatar
exampleData
@cwervo
// View at https://stevekrouse-expressHTMLExample.express.val.run?name=Steve
Script
// View at https://stevekrouse-expressHTMLExample.express.val.run?name=Steve
export async function exampleData(req: express.Request, res: express.Response) {
return res.send(JSON.stringify({ data: [0, 1, 2, 3, 4, 5, 6] }));
// Forked from @stevekrouse.expressHTMLExample
toowired avatar
windsurf_automationHelper
@toowired
// Project Automation Helper Val
Script
// Project Automation Helper Val
export const automationHelper = {
state: {
lastRun: new Date(),
tasks: [],
validationRules: []
// HTTP endpoint for automation requests
async onRequest(req) {
if (req.method === "POST") {
const { action, params } = await req.json();
iamseeley avatar
pyodideSquare
@iamseeley
An interactive, runnable TypeScript val by iamseeley
HTTP
export const pyodideExample = () => {
const html = `
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>My Pyodide App</title>
<script type="text/javascript" src="https://cdn.jsdelivr.net/pyodide/v0.25.1/full/pyodide.js"></script>
</head>
<body>
jeffreyyoung avatar
dryChocolateStarfish
@jeffreyyoung
An interactive, runnable TypeScript val by jeffreyyoung
HTTP
export default () => new Response("hi");
ychu avatar
aqi
@ychu
An interactive, runnable TypeScript val by ychu
Script
export let aqi = async () => {
let pm25 = (
await fetchJSON(
"https://api.openaq.org/v2/latest?" +
new URLSearchParams({
limit: "10",
page: "1",
location: "San Francisco",
offset: "0",
sort: "desc",
xkonti avatar
makeHtmlPage
@xkonti
An interactive, runnable TypeScript val by xkonti
Script
export interface PageOptions {
title?: string;
cssLinks?: string[];
scriptLinks?: string[];
export const makeHtmlPage = async (
content: string,
options: PageOptions = {},
): Promise<string> => {
const { title = "Document", cssLinks = [], scriptLinks = [] } = options;
const cssLinksHtml = cssLinks
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." }, {
status: 400,
try {
return Response.json({ok:true});
} catch (e) {
return Response.json({ message: "The body of this request was not JSON-encoded." }, {
status: 400,