Search

Results include substring matches and semantically similar vals. Learn more
willthereader avatar
FanFicScraper
@willthereader
@jsxImportSource https://esm.sh/react
HTTP
/** @jsxImportSource https://esm.sh/react */
// last stable version is v138
function App() {
const [url, setUrl] = useState("");
const [result, setResult] = useState(null);
const [loading, setLoading] = useState(false);
const handleSubmit = async (e) => {
e.preventDefault();
setLoading(true);
console.log(`Submitting URL for scraping: ${url}`);
janpaul123 avatar
valTownChatGPT2
@janpaul123
https://x.com/JanPaul123/status/1811801305066651997 Fork it and authenticate with your Val Town API token as the password.
HTTP (deprecated)
https://x.com/JanPaul123/status/1811801305066651997
Fork it and authenticate with your Val Town API token as the password.
/** @jsxImportSource https://esm.sh/react */
const vt = new ValTown({ bearerToken: Deno.env.get("valtown") });
const username = "janpaul123";
const app = new Hono();
const jsxResponse = (jsx) => {
return new Response(renderToString(jsx), { headers: { "Content-Type": "text/html" } });
function renderForm(
valName: string,
dvdsgl_old avatar
confetti
@dvdsgl_old
An interactive, runnable TypeScript val by dvdsgl_old
Script
import { skypack } from "https://esm.town/v/dvdsgl/skypack";
export let confetti = async () => {
const { default: confetti } = await skypack("canvas-confetti");
confetti();
vtdocs avatar
octokitExample
@vtdocs
An interactive, runnable TypeScript val by vtdocs
Script
export const octokitExample = (async () => {
const { Octokit } = await import("npm:@octokit/core");
const octokit = new Octokit();
const user = await octokit.request("GET /users/{username}", {
username: "stevekrouse",
headers: {
"X-GitHub-Api-Version": "2022-11-28",
console.log(user);
acmu avatar
clearMyApi
@acmu
An interactive, runnable TypeScript val by acmu
Script
let { fizz } = await import("https://esm.town/v/acmu/fizz");
export function clearMyApi(name) {
fizz = "";
return "clear yes nbnbnb";
rayman avatar
HTMXQuill
@rayman
@jsxImportSource https://esm.sh/preact
HTTP (deprecated)
/** @jsxImportSource https://esm.sh/preact */
// import Quill from "npm:quill";
export default async function(req: Request) {
if (req.method === "POST") {
const name = (await req.formData()).get("name");
return new Response(render(<>Hello {name || "World"}!</>));
return new Response(
render(
<html>
<head>
yawnxyz avatar
orangeVole
@yawnxyz
An interactive, runnable TypeScript val by yawnxyz
HTTP (deprecated)
/** @jsx jsx */
const app = new Hono();
const Layout = ({ children, title = "Content Summary and Tagging" }) => (
<html lang="en">
<head>
<title>{title}</title>
<script src="https://unpkg.com/htmx.org@1.9.12"></script>
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://unpkg.com/htmx.org@1.9.12/dist/ext/loading-states.js"></script>
</head>
triptych avatar
bio
@triptych
@jsxImportSource https://esm.sh/react
HTTP (deprecated)
/** @jsxImportSource https://esm.sh/react */
export default async function(req: Request) {
return new Response(
renderToString(
<html>
<head>
<meta charSet="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Andrew Wooldridge</title>
</head>
stevekrouse avatar
parsePacoEx
@stevekrouse
An interactive, runnable TypeScript val by stevekrouse
Script
export const parsePacoEx = (async () => {
var pako = await import("npm:pako");
function decodeMermaid(encodedString) {
var binaryData = Buffer.from(encodedString, "base64");
var inflatedString = pako.inflate(binaryData, { to: "string" });
return inflatedString;
return JSON.parse(
decodeMermaid(
"eNp1kk1rwzAMhv-K8WmFhLEeO9gYW2GDjnVtj76osdIYHDv4o2sJ-e-T42Snzpco0quH15Z6XlmJfMVPDrqGbXaPwjA6-wAu3N2Nn8WiLJ--I_qgrHnoBX
).code;
taras avatar
fireworks_ai_proxy
@taras
HTTP (deprecated)
const COMPLETION = "/chat/completions";
const MODELS = "/models";
const supported_urls = [COMPLETION, MODELS];
// Define a common set of CORS headers
const corsHeaders = {
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, OPTIONS",
"Access-Control-Allow-Headers": "*",
function err(msg): Response {
return new Response(
yawnxyz avatar
push
@yawnxyz
@jsxImportSource npm:hono@3/jsx
HTTP (deprecated)
/** @jsxImportSource npm:hono@3/jsx */
// TODO: in an upcoming version of deno, you can also use npm:web-push which is much more popular
// by just using pushSendNotification
// .svg required for manifest, fav.farm doesn't seem to mind
const iconURL = "https://fav.farm/%F0%9F%94%94.svg";
const app = new Hono();
const vapidDetails = {
url: thisWebURL(),
pubKey: Deno.env.get("qushVapidPublicKey"),
privKey: Deno.env.get("qushVapidPrivateKey"),
kiven avatar
short
@kiven
// Forked from @tmcw.short
Express
export let short = async (req, res) => {
const param = req.path.substring(1);
const { default: Hashids } = await import("npm:hashids");
const H = new Hashids(short_storage.salt);
if (!param) {
const { default: htm } = await import("npm:htm");
const { default: vhtml } = await import("npm:vhtml");
const html = htm.bind(vhtml);
if (req.method === "GET") {
return res.send(html`<html><head><title>URL Shortener</title>
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);
cofsana avatar
VALLErun
@cofsana
The actual code for VALL-E: https://www.val.town/v/janpaul123/VALLE
HTTP (deprecated)
The actual code for VALL-E: https://www.val.town/v/janpaul123/VALLE
/** @jsxImportSource https://esm.sh/react */
function parseSearchReplaceBlocks(content: string): Array<{ searchStart: string; searchEnd: string; replace: string }> {
content = content.replaceAll("\r\n", "\n");
const regex =
/\[SEARCH_START_SINGLE_LINE\]\n([\s\S]*?)\n\[\/SEARCH_START_SINGLE_LINE\]\s*\[SEARCH_END_SINGLE_LINE\]\n([\s\S]*?)\n?\[\/
const blocks = [];
let match;
while ((match = regex.exec(content)) !== null) {
blocks.push({
tmcw avatar
datefnsExample
@tmcw
date-fns date-fns is a much better alternative to moment . It's much smaller, simpler, and easier to use. Plus, it supports ESM - notice how I can just import add and formatRelative here! Use it for all your date needs.
Script
# date-fns
[date-fns](https://date-fns.org/) is a much better alternative to [moment](https://www.val.town/v/tmcw.momentExample). It's m
export let datefnsExample = (async () => {
const { add, formatRelative } = await import("npm:date-fns");
return formatRelative(add(new Date(), { minutes: 10 }), new Date());