Search
val_town_client_example
@pomdtr
Typed Client for the Val Town API Automatically generated using open-api-typescript and openapi-fetch .
Script
# Typed Client for the Val Town API
Automatically generated using [open-api-typescript](https://www.npmjs.com/package/openapi-typescript) and [openapi-fetch](https://www.npmjs.com/package/openapi-fetch).
import createClient from "https://esm.town/v/pomdtr/val_town_client";
const client = createClient({
token: Deno.env.get("valtown"),
const { data, error } = await client.GET("/v1/search/vals", {
params: {
LegoIWant
@opeala
@jsxImportSource https://esm.sh/react
HTTP
/** @jsxImportSource https://esm.sh/react */
// import { faCoffee } from "npm:@fortawesome/free-solid-svg-icons";
} from "npm:@fortawesome/free-brands-svg-icons";
import { FontAwesomeIcon } from "npm:@fortawesome/react-fontawesome";
import { renderToString } from "npm:react-dom/server";
export default async function(req: Request) {
commendableTealFerret
@Bossbaby
@jsxImportSource https://esm.sh/react
HTTP
/** @jsxImportSource https://esm.sh/react */
import React, { useState, useEffect, useRef, useCallback } from "https://esm.sh/react";
import { createRoot } from "https://esm.sh/react-dom/client";
// Commodities specific to Bangladesh
linkInBioTemplate
@ototao
A simple linketree-esque page originally made by Steve Krouse
HTTP
/** @jsxImportSource https://esm.sh/react */
import { renderToString } from "npm:react-dom/server";
export default async function(req: Request) {
return new Response(
FindTrendsUsingGPT
@weaverwhale
An interactive, runnable TypeScript val by weaverwhale
HTTP
const styles = "<style>* { font-family: sans-serif; }</style>";
const mermaidClient = `
<script type="module">
// Buffer the HTML content
let htmlContent = styles + mermaidClient;
let finalContent = "";
await trendGPT(JSON.stringify(trendsData), (streamedData) => {
finalContent = styles + mermaidClient + marked.parse(streamedData, {
breaks: true,
valle_tmp_125920830351466952258206466703858
@janpaul123
// This val will create a simple comment box using a form. Comments are persisted using SQLite
HTTP
// This val will create a simple comment box using a form. Comments are persisted using SQLite
// and it will display all previous comments. The HTTP route uses a server-side approach to
// handle both displaying comments and submitting new ones.
import { blob } from "https://esm.town/v/std/blob?v=11";
modifyIframeResponse
@nbbaier
Prevents your http vals from being viewed inside iframes. If it's a valtown iframe, a helpful message is displayed. Usage: import modifyIframeResponse from "https://esm.town/v/nbbaier/modifyIframeResponse";
export default modifyIframeResponse(async (req: Rquest): Promise<Response> => {
return Response.json({ ok: true })
});
Script
Prevents your http vals from being viewed inside iframes. If it's a valtown iframe, a helpful message is displayed. Usage:
```ts
whoIsHiringAbout
@vawogbemi
@jsxImportSource https://esm.sh/react
Script
/** @jsxImportSource https://esm.sh/react */
export default function About() {
const linkClass = "text-sky-600 hover:text-sky-500";
honoReactExportModeScript
@tfayyaz
@jsxImportSource https://esm.sh/react
Script
/** @jsxImportSource https://esm.sh/react */
import { useState } from "https://esm.sh/react@18.2.0";
function MyButton() {
const [count, setCount] = useState(0);
bonsaiReducer
@beneskildsen
An interactive, runnable TypeScript val by beneskildsen
Script
// don't even use doSnip on here since it's too slow
const { pos, clientID, grammar } = action;
if (clientID != 1 && state.snips[clientID]) {
return state;
state.snips[clientID] = true;
return { ...state, grammar };
createRelevantComment
@thomasatflexos
An interactive, runnable TypeScript val by thomasatflexos
Script
.json({
message: "The content and url parameter is required for this end point",
const { createClient } = await import(
"https://esm.sh/@supabase/supabase-js@2"
const supabase = createClient(
process.env.supabaseURL,
process.env.supabaseKey,
redirect
@thomasatflexos
This is a handler for when Notion redirects during OAuth 2.0 workflow
Express (deprecated)
// This endpoint uses Basic Authentication which requires a 64-encoded token
const token = process.env.OAUTH_CLIENT_ID + ":" +
process.env.OAUTH_CLIENT_SECRET;
const response = await fetch("https://api.notion.com/v1/oauth/token", {
// Using supabase to store out information
const { createClient } = await import(
"https://esm.sh/@supabase/supabase-js@2"
const supabase = createClient(
process.env.supabaseURL,
sqliteStyle
@stevekrouse
An interactive, runnable TypeScript val by stevekrouse
Script
background: var(--bg);
.sidebar-layout {
display: flex;
width: 100%;
.sidebar {
width: fit-content;
.not-sidebar {
flex: 1;
overflow: auto;
.not-sidebar > div:first-child,
.not-sidebar > form:first-child {
padding-top: 0.5rem;
min-height: 12rem;
.not-sidebar > form {
margin: 0;
font-family: var(--mono-font);
padding: 4px var(--gap) var(--gap) var(--gap); /* No padding on top, and padding on other sides */
white-space: wrap;
vimarkdown
@jxnblk
vimarkdown Try it now A VIM-mode markdown editor built with Val Town . Features Write markdown in the browser with VIM keybindings Minimal, focused UI Saves to localStorage Multiple color modes Markdown -> HTML preview (⌘+P) NOT mobile-friendly Fork this editor on Val Town to make it your own Inspired by iA Writer
Made by Jxnblk TODO [ ] Add syntax highlighting to frontmatter block [ ] Support multiple fonts
HTTP
/** @jsxImportSource https://esm.sh/react */
import { ViewUpdate } from "https://esm.sh/@codemirror/view";
import graymatter from "https://esm.sh/gray-matter";
import { useEffect, useMemo, useState } from "https://esm.sh/react";
import { GoogleFonts } from "https://esm.town/v/jxnblk/reactGoogleFonts";
// preview
import ReactMarkdown from "https://esm.sh/react-markdown@9";
import rehypeSanitize from "https://esm.sh/rehype-sanitize@6";
// vals
import { render } from "https://esm.town/v/jxnblk/ReactStream";
import { EditorView, Prec, useCodemirror } from "https://esm.town/v/jxnblk/useCodemirrorVimMD";
console.log("vim-mode-change", e);
const handleKeyDown = (e: React.KeyboardEvent) => {
// check for insert mode?
</pre>
<ReactMarkdown
children={content}
notUberRides
@vawogbemi
@jsxImportSource https://esm.sh/react@18.2.0
Script
/** @jsxImportSource https://esm.sh/react@18.2.0 */
import { init } from "https://esm.sh/@instantdb/react?deps=react@18.2.0";
import { IconCar, IconCarFilled } from "https://esm.sh/@tabler/icons-react?deps=react@18.2.0";
import { useNavigate } from "https://esm.sh/react-router-dom?deps=react@18.2.0";
import React from "https://esm.sh/react@18.2.0";
import { INSTANTDB_APP_ID } from "https://esm.town/v/vawogbemi/notUberConsts";