Search
fetchJSON
@stevekrouse
An interactive, runnable TypeScript val by stevekrouse
Script
export const fetchJSON = async (
url: string | URL,
options?: RequestInit & {
bearer?: string;
fetch?: typeof fetch;
let headers = new Headers(options?.headers ?? {});
headers.set("accept", "application/json");
if (options?.bearer) {
headers.set("authorization", `Bearer ${options.bearer}`);
const traceparent = Deno.env.get("vt-traceparent");
blobbyFace
@natashatherobot
(todo) This lists all your blobs. You can create new blobs, edit them, or even preview (and upload) file blobs from both URL and computer!
HTTP (deprecated)
(todo)
This lists all your blobs. You can create new blobs, edit them, or even preview (and upload) file blobs from both URL and computer!
// import { MagikaNode as Magika } from "npm:magika"; // doesn't yet work :(
const app = new Hono();
const DOWNLOAD_URL = "https://yawnxyz-serve.web.val.run"; // https://yawnxyz-serve.web.val.run/myImage.jpg
// Define an array of JSON objects
let blobbyList = await blobby.list();
// blobbyList = blobbyList.slice(0, 40); // prototyping
console.log("blobbyList:", blobbyList.length);
async function streamToBuffer(stream) {
turndownExample
@yawnxyz
An interactive, runnable TypeScript val by yawnxyz
Script
export const turndown = async (text) => {
const turndown = await import("npm:turndown");
const plugin = await import("npm:turndown-plugin-gfm");
const turndownService = new turndown.default({
emDelimiter: "*",
codeBlockStyle: "fenced",
turndownService.use(plugin.gfm);
return turndownService.turndown(text);
let html = "<h1>hello</h1>"
console.log(await turndown(html)
frame
@nlnw
Minimal val.town Farcaster Frame example. It supports dynamic image generation with Satori and ReSVG, and it's compatible with the Open Frames standard.
HTTP (deprecated)
Minimal val.town Farcaster Frame example. It supports dynamic image generation with Satori and ReSVG, and it's compatible with the Open Frames standard.
/** @jsxImportSource npm:hono@3/jsx */
const app = new Hono();
async function renderImage(s: string, color: string) {
const fontArrayBuf = await fetch(
"https://cdn.jsdelivr.net/npm/roboto-font@0.1.0/fonts/Roboto/roboto-regular-webfont.ttf",
).then((res) => res.arrayBuffer());
const svg = await satori(
type: "div",
props: {
testing
@tmcw
An interactive, runnable TypeScript val by tmcw
Script
const stream = test.createStream({ objectMode: true });
stream.on("data", function(row) {
console.log(JSON.stringify(row));
test("timing test", function(t) {
t.plan(2);
t.equal(typeof Date.now, "function");
var start = Date.now();
setTimeout(function() {
t.equal(Date.now() - start, 100);
}, 100);
prettifyTS
@pomdtr
Prettify Typescript code const pretty = await @pomdtr.prettifyTS("const hello='Hello world'")
Script
# Prettify Typescript code
```ts
const pretty = await @pomdtr.prettifyTS("const hello='Hello world'")
export async function prettifyTS(code: string) {
const prettier = await import(
"https://unpkg.com/prettier@3.0.1/standalone.mjs"
const prettierPluginTypescript = await import(
"https://unpkg.com/prettier@3.0.1/plugins/typescript.mjs"
const prettierPluginEstree = await import(
"https://unpkg.com/prettier@3.0.1/plugins/estree.mjs"
tryingciceroagain
@arthrod
@jsxImportSource https://esm.sh/react
HTTP
/** @jsxImportSource https://esm.sh/react */
const GlobalStyle = createGlobalStyle`
body {
margin: 0;
padding: 0;
font-family: 'Roboto', sans-serif;
background-color: #FFFFFF;
color: #1D1D1D;
line-height: 1.6;
overflow-x: hidden;
valwriter
@janpaul123
[ ] streaming [ ] send the code of the valwriter back to gpt (only if it's related, might need some threads, maybe a custom gpt would be a better fix, of course, could do it as a proxy...) [ ] make it easy to send errors back to gpt [ ] make it easy to get screenshots of the output back to gpt
HTTP (deprecated)
- [ ] streaming
- [ ] send the code of the valwriter back to gpt (only if it's related, might need some threads, maybe a custom gpt would be a better fix, of course, could do it as a proxy...)
- [ ] make it easy to send errors back to gpt
- [ ] make it easy to get screenshots of the output back to gpt
/** @jsxImportSource npm:hono@3/jsx */
const examples = [
user: "website that shows the current time",
content: `/** @jsxImportSource npm:react */
export default function() {
return <h1>{new Date().toLocaleTimeString()}</h1>;
sauron
@agmm
An interactive, runnable TypeScript val by agmm
HTTP (deprecated)
const app = new Hono();
const count = await blob.getJSON("count") as number || 0;
app.get("/", async (c) => {
await blob.setJSON("count", count + 1);
const eyes = new Array(count).fill("👁️").join("");
return c.text(`Every visit adds an eye.\n\n${eyes}`);
app.get("/reset", async (c) => {
const { key } = c.req.query();
if (key !== Deno.env.get("EYE_KEY")) {
c.status(401);
dateme_faq
@vawogbemi
@jsxImportSource npm:hono@3/jsx
Script
/** @jsxImportSource npm:hono@3/jsx */
let linkClass = "text-sky-600 hover:text-sky-500";
export default function FAQ(c) {
return c.html(
<Layout activeTab={new URL(c.req.url).pathname}>
<div class="max-w-2xl mx-auto p-10">
<h1 class="my-3 font-bold text-4xl">FAQ</h1>
<h2 class="my-3 font-bold text-xl my-3">First of all</h2>
<p>
I want to thank my mom, Kanye, and obviosuly Ice Spice.
delayEx
@stevekrouse
An interactive, runnable TypeScript val by stevekrouse
Script
export const delayEx = (async () => {
const { default: delay } = await import("npm:delay");
console.log(performance.now());
await delay(1000);
console.log(performance.now());
crimsonLynx
@stevekrouse
@jsxImportSource https://esm.sh/react
HTTP (deprecated)
/** @jsxImportSource https://esm.sh/react */
export const personalWebsite = (request: Request) => {
return new Response(
renderToString(
<html>
<head>
<title>Will Krouse</title>
<style
dangerouslySetInnerHTML={{
__html:
whiteNewt
@maxm
@jsxImportSource https://esm.sh/react
HTTP (deprecated)
/** @jsxImportSource https://esm.sh/react */
export default async function(req: Request): Promise<Response> {
return new Response(
renderToString(
<script type="module" src="https://esm.town/v/maxm/codemirrorTsBrowser" />
<form>
<textarea id="editorSource" className="for-codemirror" name="editorSource">
{`let hasAnError: string = 10;
function increment(num: number) {
return num + 1;
preact_test_component
@pomdtr
@jsxImportSource https://esm.sh/preact
Script
/** @jsxImportSource https://esm.sh/preact **/
import register from "https://esm.sh/preact-custom-element";
const Greeting = ({ name = "World" }) => <p>Hello, {name}!</p>;
register(Greeting, "x-greeting", ["name"], { shadow: true });
blobbyFace
@stevekrouse
(todo) This lists all your blobs. You can create new blobs, edit them, or even preview (and upload) file blobs from both URL and computer!
HTTP (deprecated)
(todo)
This lists all your blobs. You can create new blobs, edit them, or even preview (and upload) file blobs from both URL and computer!
// import { MagikaNode as Magika } from "npm:magika"; // doesn't yet work :(
const app = new Hono();
const DOWNLOAD_URL = "https://yawnxyz-serve.web.val.run"; // https://yawnxyz-serve.web.val.run/myImage.jpg
// Define an array of JSON objects
let blobbyList = await blobby.list();
// blobbyList = blobbyList.slice(0, 40); // prototyping
console.log('blobbyList:', blobbyList.length);
async function streamToBuffer(stream) {