Search

Results include substring matches and semantically similar vals. Learn more
tempdev avatar
anime
@tempdev
@jsxImportSource npm:hono@3/jsx
HTTP (deprecated)
/** @jsxImportSource npm:hono@3/jsx */
const app = new Hono();
app.get("/embed/:id/:ep/:dub", async (c) => {
const id = c.req.param("id");
const ep = Number(c.req.param("ep"));
const dub = c.req.param("dub") === "dub";
const results = [];
const metaResponse = await fetch(
`https://cool-proxy.koyeb.app/hdiuhmalkmc9d0ck7UCFVGBJHN?destination=https://api.malsync.moe/mal/anime/${id}`,
const metaData = await metaResponse.json();
stevekrouse avatar
jsonresumeEx
@stevekrouse
An interactive, runnable TypeScript val by stevekrouse
Script
import { fetchText } from "https://esm.town/v/stevekrouse/fetchText";
export const jsonresumeEx = (async () => {
let { render } = await import("npm:jsonresume-theme-standard-resume");
return render(
await fetchText(
"https://gist.githubusercontent.com/thomasdavis/c9dcfa1b37dec07fb2ee7f36d7278105/raw/b7c543a5de99d9bed90ca4fe5e506f8c0b
iamseeley avatar
pipeline
@iamseeley
Using Pipeline import Pipeline from "https://esm.town/v/iamseeley/pipeline"; const pipeline = new Pipeline("task", "model"); const result = await pipeline.run(inputs); exampleTranslation exampleTextClassification exampleFeatureExtraction exampleTextGeneration exampleSummarization exampleQuestionAnswering
Script
## Using Pipeline
```ts
const pipeline = new Pipeline("task", "model");
const result = await pipeline.run(inputs);
[exampleTranslation](https://www.val.town/v/iamseeley/exampleTranslation)
[exampleTextClassification](https://esm.town/v/iamseeley/exampleTextClassification)
const HUGGING_FACE_API_URL = "https://api-inference.huggingface.co/models";
const HUGGING_FACE_API_KEY = Deno.env.get("HUGGING_FACE_API_KEY");
const defaultModels = {
"feature-extraction": "sentence-transformers/all-MiniLM-L6-v2",
yawnxyz avatar
blurbs
@yawnxyz
Blurbs Generator Give it a link (article, Science paper, or a PDF link), get a blurb and a bunch of tags. Built for Capsid & Tail but you can obviously use it for whatever
HTTP
# Blurbs Generator
Give it a link (article, Science paper, or a PDF link), get a blurb and a bunch of tags.
Built for [Capsid & Tail](https://phage.directory/capsid) but you can obviously use it for whatever
/** @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>
all avatar
bikeInventory
@all
@jsxImportSource https://esm.sh/react
HTTP
/** @jsxImportSource https://esm.sh/react */
const APP_ID = "5518c0f9-481c-4aa8-85cd-eee42bd45319";
function BikeWindow({ bike, onSave, onClose, title }) {
const [brand, setBrand] = useState(bike?.brand || "");
const [model, setModel] = useState(bike?.model || "");
const [type, setType] = useState(bike?.type || "");
const [year, setYear] = useState(bike?.year || "");
const [lastMaintenance, setLastMaintenance] = useState(bike?.lastMaintenance || "");
const [imageUrl, setImageUrl] = useState(bike?.imageUrl || "");
const handleSubmit = (e) => {
szymonator avatar
surfboardDemoSchedule2
@szymonator
// WELCOME TO THE API DEMO
HTTP (deprecated)
// WELCOME TO THE API DEMO
// Since val.town doesn't behave well, we cannot access the value of inputs after the page has been loaded once.
// Therefore, the only way to let the user modify their values is to do it manually.
// Simly edit the number to what you want it to be.
// DO NOT EDIT THE BELOW
/** @jsxImportSource https://esm.sh/react */
// BELOW ARE THE HOURLY RATES FOR AN ON CALL SHIFT, AND A REGULAR SHIFT. THE DEFAULT IS £24 AND £12.
// TO CHANGE THIS, EDIT THE NUMBERS NEXT TO THE '=' SIGN.
const callCostH = 24;
const regCostH = 12;
u avatar
refresher
@u
An interactive, runnable TypeScript val by u
RPC
export async function refresher(name: string) {
let resp = "";
if (refreshData[name] === undefined) {
await alert(
name,
`Tracking setup successful for ${name}! \uD83D\uDE00`,
resp = `Setup successful for ${name}!`;
else {
resp = `Refresh successful for ${name}!`;
refreshData[name] = Date.now();
moe avatar
spacex
@moe
SpaceX Launch tracker todo: fetch and persist data on regular basis display data from cache
HTTP
SpaceX Launch tracker
todo:
- fetch and persist data on regular basis
- display data from cache
/** @jsxImportSource npm:hono@3/jsx */
const app = new Hono()
export default app.fetch
const baseUrl = "https://moe-spacex.web.val.run"
const homeFrame = {
image: "/image",
ralfw avatar
curveMinusServer
@ralfw
An interactive, runnable TypeScript val by ralfw
Script
export const curveMinusServer = async (req: Request) => {
const { Hono } = await import("npm:hono");
const app = new Hono();
app.get("/calc", (c) => {
const x = parseFloat(String(c.req.query("x")));
const y = curveMinus(x);
return c.json({ result: y });
app.get("/ai-plugin.json", (c) => c.text(curveMinusManifest));
app.get("/openapi.yaml", (c) => c.text(curveMinusOpenAPI));
return app.fetch(req);
tmcw avatar
qsExample
@tmcw
qs QS is a pretty old module that you probably shouldn't use but it's still pretty heavily used. In the very very early days there wasn't a built-in way in JavaScript to parse querystrings. So QS was born. But then, Node.js added a querystring module built-in. Then, JavaScript introduced URLSearchParams , which you should use whenever you want to parse or generate query strings.
Script
# qs
[QS](https://github.com/ljharb/qs/) is a pretty old module that you probably shouldn't use but it's still pretty heavily used
In the very very early days there wasn't a built-in way in JavaScript to parse querystrings. So QS was born. But then, Node.j
export let qsExample = (async () => {
const qs = await import("npm:qs");
return qs.parse("?hi=there");
stevekrouse avatar
blobCommentsReact
@stevekrouse
@jsxImportSource https://esm.sh/react
HTTP (deprecated)
/** @jsxImportSource https://esm.sh/react */
function App() {
const [comments, setComments] = useState();
const [newComment, setNewComment] = useState("");
useEffect(() => {
fetch("/comments")
.then(response => response.json())
.then(data => setComments(data));
const handleSubmit = async (e) => {
e.preventDefault();
natalyazheng1 avatar
grayDormouse
@natalyazheng1
// Fetches a random joke.
Cron
export const SAMPLE_JOKE = {
"setup": "What do you call a group of disorganized cats?",
"punchline": "A cat-tastrophe.",
// Fetches a random joke.
// function fetchRandomJoke() {
// const SAMPLE_JOKE = {
// "setup": "What do you call a group of disorganized cats?",
// "punchline": "A cat-tastrophe.",
// return SAMPLE_JOKE;
// const randomJoke = fetchRandomJoke();
stevekrouse avatar
plotLinkeDOMSRRExample
@stevekrouse
An interactive, runnable TypeScript val by stevekrouse
HTTP (deprecated)
export default async function() {
const document = parseHTML("<a>").document;
const chart = Plot.plot({
document,
marks: [
Plot.rectY({ length: 10000 }, Plot.binX({ y: "count" }, { x: Math.random })),
return new Response(
`${chart}`.replace(
/^<svg /,
"<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" version=\"1.1\" ",
arthrod avatar
rainyAquamarineDonkey
@arthrod
@jsxImportSource https://esm.sh/react
HTTP
/** @jsxImportSource https://esm.sh/react */
const pulsate = keyframes`
0% { transform: scale(1); }
50% { transform: scale(1.05); }
100% { transform: scale(1); }
const CentralDot = styled.div`
width: 200px;
height: 200px;
border-radius: 50%;
background: radial-gradient(circle at 30% 30%, #FF6B6B, #D62828);
nuklearfiziks avatar
bigLeagueMe
@nuklearfiziks
Big League yourself! WARNING, this will unfollow every user you follow!
Script
Big League yourself! WARNING, this will unfollow every user you follow!
export const bigLeagueMe = async (req: Request) => {
const params = Object.fromEntries(new URL(req.url).searchParams.entries());
var {default: atproto} = await import("npm:@atproto/api");
const BskyAgent = atproto.
// YOUR bluesky handle
// Ex: user.bsky.social
const handle = params.HANDLE || "";
// YOUR bluesky password, or preferably an App Password (found in your client settings)
// Ex: abcd-1234-efgh-5678