Search

Results include substring matches and semantically similar vals. Learn more
dhvanil avatar
val_4LGR17ZrGm
@dhvanil
An interactive, runnable TypeScript val by dhvanil
Script
export default async function handler(req) {
try {
const result = await (async () => {
karfau avatar
githubEmoji
@karfau
Usage import {githubEmojiUrl} from "https://esm.town/v/karfau/githubEmoji"; console.log(githubEmojiUrl('+1')) //"https://github.githubassets.com/images/icons/emoji/unicode/1f44d.png?v8" or in a browser <img src="https://karfau-githubEmoji.web.val.run/+1"></img> Looks like in the preview. curl https://karfau-githubEmoji.web.val.run/+1 (prints "https://github.githubassets.com/images/icons/emoji/unicode/1f44d.png?v8" ) If the name you pass (as argument or in the request path) is not in the list, it returns The list of names can be accessed using githubEmojiNames or by calling https://karfau-githubemoji.web.val.run/names
HTTP
If the name you pass (as argument or in the request path) is not in the list, it returns ![octocat](https://karfau-githubEmoj
The list of names can be accessed using `githubEmojiNames` or by calling <https://karfau-githubemoji.web.val.run/names>
GITHUB_EMOJIS[isEmoji(name) ? name : fallback];
export const githubEmojiNames = (): string[] => Object.keys(GITHUB_EMOJIS);
export default async function githubEmoji(req: Request): Promise<Response> {
const contentType = req.headers.get("Content-Type");
const nameFromURL = new URL(req.url).pathname.split("/").filter(Boolean)[0];
Kpool avatar
cafetiraCafeAndBilliardTournament
@Kpool
@jsxImportSource https://esm.sh/react@18.2.0
HTTP
import React, { useEffect, useState } from "https://esm.sh/react@18.2.0";
function App() {
const [selectedCategory, setSelectedCategory] = useState("cafe");
color: "white",
function client() {
createRoot(document.getElementById("root")).render(<App />);
if (typeof document !== "undefined") { client(); }
export default async function server(request: Request): Promise<Response> {
const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
pomdtr avatar
githubNotifications
@pomdtr
An interactive, runnable TypeScript val by pomdtr
Script
import { fetch } from "https://esm.town/v/std/fetch";
import process from "node:process";
export async function githubNotifications() {
const res = await fetch("https://api.github.com/notifications?all=true", {
headers: {
isidentical avatar
fluxImageGenerator
@isidentical
Sign in to fal.ai, generate an API key, and set it as FAL_KEY for your account.
HTTP
firstRequest: number;
function LightningBolt({ x, y }) {
return (
</svg>
function Background() {
const [bolts, setBolts] = useState([]);
</svg>
function LoadingSpinner() {
return (
</div>
function App() {
const [prompt, setPrompt] = useState(DEFAULT_PROMPT);
</div>
function client() {
createRoot(document.getElementById("root")).render(<App />);
client();
async function checkRateLimit(clientIP: string): Promise<boolean> {
const now = Date.now();
return clientData.count <= RATE_LIMIT;
async function server(request: Request): Promise<Response> {
if (request.method === "POST" && new URL(request.url).pathname === "/generate") {
Vanshii_244 avatar
urgentVoicemailApp
@Vanshii_244
@jsxImportSource https://esm.sh/react@18.2.0
HTTP
import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
function LandingPage() {
const [imageUrl] = useState(`https://maxm-imggenurl.web.val.run/young-girl-tech-entrepreneur-cartoon-style-holding-smartpho
</div>
function client() {
createRoot(document.getElementById("root")).render(<LandingPage />);
if (typeof document !== "undefined") { client(); }
export default async function server(request: Request): Promise<Response> {
return new Response(`
janpaul123 avatar
valle_tmp_02822027275220717634088312286962297
@janpaul123
// This val will respond with a HTML page styled with fun CSS
HTTP
// This val will respond with a HTML page styled with fun CSS
export default async function main(): Promise<Response> {
const htmlContent = `
<!DOCTYPE html>
dhvanil avatar
val_w1RxWevh7s
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export default async function handler(req) {
try {
const result = await (async () => {
iheartjankboteko avatar
iheartJankBoteko
@iheartjankboteko
An interactive, runnable TypeScript val by iheartjankboteko
HTTP
export default async function (req: Request): Promise<Response> {
return Response.json({ ok: true })
janpaul123 avatar
valle_tmp_0446237677109970758188110346103484
@janpaul123
// This val will simply respond with "Hello, World!"
HTTP
// This val will simply respond with "Hello, World!"
export default async function(req: Request): Promise<Response> {
return new Response("Hello, World!");
willthereader avatar
functionExercise
@willthereader
// make a function, a variable containing a function, block body arrow function,
Script
// make a function, a variable containing a function, block body arrow function,
// and concise body syntax arrow function
function adder(num1, num2) {
return num1 + num2;
adder(1, 2);
let subtracter = function minus(num1, num2) {
return num1 - num2;
liamdanielduffy avatar
createValFromCljs
@liamdanielduffy
An interactive, runnable TypeScript val by liamdanielduffy
Script
import { compileCljsToES6 } from "https://esm.town/v/liamdanielduffy/compileCljsToES6";
import { updateValByName } from "https://esm.town/v/nbbaier/updateValByName";
export async function createValFromCljs(name: string, cljs: string) {
return updateValByName({
token: Deno.env.get("valtown"),
arfan avatar
geminichat
@arfan
@jsxImportSource https://esm.sh/react@18.2.0
HTTP
// SECTION 2: DATABASE FUNCTIONS
function createDatabaseFunctions(sqlite, KEY, SCHEMA_VERSION) {
// SECTION 3: SERVER FUNCTION
export default async function server(request: Request): Promise<Response> {
const db = createDatabaseFunctions(sqlite, KEY, SCHEMA_VERSION);
function Settings({ isOpen, onClose }) {
function formatMessage(content) {
function Message({ role, content, debug }) {
function App() {
function client() {
patrickjm avatar
getReplicatePrediction
@patrickjm
Get the status or result of a prediction on replicate.com https://replicate.com/docs/reference/http#get-prediction
Script
Get the status or result of a prediction on replicate.com
https://replicate.com/docs/reference/http#get-prediction
export async function getReplicatePrediction({
/** https://replicate.com/account */
apiKey,
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;