Search
interactiveBrokersMargins
@simone
An interactive, runnable TypeScript val by simone
Script
let { interactiveBrokersMarginsState } = await import("https://esm.town/v/simone/interactiveBrokersMarginsState");
export async function interactiveBrokersMargins() {
function zip(...arrays) {
const result = [];
return result;
async function loadInteractiveBrokersData() {
const cheerio = await import("npm:cheerio");
postmanClone
@maxm
* This val creates a Postman-like interface for testing HTTP requests directly in the browser.
* It uses React for the UI and the Fetch API to make requests.
* The server function serves the HTML and handles the API requests.
HTTP
* It uses React for the UI and the Fetch API to make requests.
* The server function serves the HTML and handles the API requests.
/** @jsxImportSource https://esm.sh/react */
import { createRoot } from "https://esm.sh/react-dom/client";
function App() {
const [url, setUrl] = useState('https://jsonplaceholder.typicode.com/posts/1');
</div>
function client() {
createRoot(document.getElementById("root")).render(<App />);
client();
async function server(request: Request): Promise<Response> {
const url = new URL(request.url);
valle_tmp_086165512507909492839503439700437
@janpaul123
// This val will respond with a styled HTML page with fun CSS
HTTP
// This val will respond with a styled HTML page with fun CSS
export default async function main(): Promise<Response> {
const htmlContent = `
<!DOCTYPE html>
getPocket
@jessmartin
An interactive, runnable TypeScript val by jessmartin
Script
import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
export function getPocket(params) {
return fetchJSON("https://getpocket.com/v3/get", {
method: "POST",
valle_tmp_174032832928853859223153633480038
@janpaul123
// This script will respond with a basic HTML page, including styled content and an animated cat GIF that crawls around the screen.
HTTP
* HTTP Val: Hello World Example (HTML Response with CSS and Animated Cat GIF)
* This script will respond with a basic HTML page that says "Hello world" to any incoming HTTP request, and includes some cool CSS styles and an animated cat GIF.
export default async function(req: Request): Promise<Response> {
const catGifURL = "https://media.giphy.com/media/JIX9t2j0ZTN9S/giphy.gif";
const htmlContent = `
spellbindingAmberSwift
@brockjeppesen
An interactive, runnable TypeScript val by brockjeppesen
HTTP
export default async function (req: Request): Promise<Response> {
return Response.json({ ok: true })

aqi
@daabin
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 = "guangzhou"; // <-- change to place, city, or zip code
const data = await easyAQI({ location });
pyodideSquare
@iamseeley
An interactive, runnable TypeScript val by iamseeley
HTTP
<p id="result"></p>
<script>
async function main() {
let pyodide = await loadPyodide();
console.log('Pyodide is ready to use!');
generateQuiz
@rayyan
An interactive, runnable TypeScript val by rayyan
HTTP
import { OpenAI } from "https://esm.town/v/std/openai";
import { z } from "npm:zod";
return str;
export default async function(req: Request): Promise<Response> {
const topic = new URL(req.url).searchParams.get("topic") ?? "JavaScript";
{ status: 400 },
const openai = new OpenAI();
const completion = await openai.chat.completions.create({
messages: [
val_HhH0AK0vuP
@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++) {
reproduceResolveModuleError
@janpaul123
// Copied from https://www.val.town/v/sqlite/db
Script
import type { ResultSet } from "npm:@libsql/client";
// Copied from https://www.val.town/v/sqlite/db
async function execute(statement: InStatement): Promise<ResultSet> {
const resp = await fetch("https://janpaul123-dummyjustproxylibsql.web.val.run", {
method: "POST",
valle_tmp_04779227870600944224693473656022
@janpaul123
// Initialize sample stories and store them in blob storage
HTTP
const SAMPLE_STORIES_KEY = "hn_sample_stories";
// Initialize sample stories and store them in blob storage
async function initializeSampleStories() {
const existingStories = await blob.getJSON(SAMPLE_STORIES_KEY);
if (!existingStories) {
personalSocialCardGenerator
@mumu
@jsxImportSource https://esm.sh/react
HTTP
import { createRoot } from "https://esm.sh/react-dom/client";
function App() {
const [cardData, setCardData] = useState(null);
</div>
function PersonalCard({ data }) {
return (
</div>
function getBackgroundColor(index) {
const colors = ["bg-blue-100", "bg-green-100", "bg-purple-100", "bg-orange-100"];
return colors[index % colors.length];
function client() {
createRoot(document.getElementById("root")).render(<App />);
client();
async function server(request: Request): Promise<Response> {
if (request.method === "POST" && new URL(request.url).pathname === "/generate") {