Search

Results include substring matches and semantically similar vals. Learn more
teachergatis avatar
sophisticatedCoffeeLandfowl
@teachergatis
@jsxImportSource https://esm.sh/react@18.2.0
HTTP
import { syntaxHighlighting, defaultHighlightStyle } from "https://esm.sh/@codemirror/language@6.2.0";
function CodeEditor() {
const [htmlCode, setHtmlCode] = useState(`
zIndex: 1000,
function client() {
createRoot(document.getElementById("root")).render(<CodeEditor />);
if (typeof document !== "undefined") { client(); }
export default async function server(request: Request): Promise<Response> {
return new Response(`
vladimyr avatar
fetchVal
@vladimyr
// SPDX-License-Identifier: 0BSD
Script
likeCount: PositiveIntegerSchema,
referenceCount: PositiveIntegerSchema,
export async function fetchVal(author: string, name: string) {
const prefixUrl = new URL("/v1/alias", API_URL);
const resp = await ky.get(`${author}/${name}`, { prefixUrl }).json();
pomdtr avatar
telegramWelcome
@pomdtr
An interactive, runnable TypeScript val by pomdtr
Script
import { sendToTelegram } from "https://esm.town/v/pomdtr/sendToTelegram";
import { secretToTelegramChat } from "https://esm.town/v/pomdtr/secretToTelegramChat";
export async function telegramWelcome(req: express.Request, res: express.Response) {
const { message } = req.body;
let secret: string;
cufaoil avatar
DeleteThing
@cufaoil
An interactive, runnable TypeScript val by cufaoil
HTTP
import { blob } from "https://esm.town/v/std/blob";
import { set } from "https://esm.town/v/std/set?v=11";
export default async function(req: Request): Promise<Response> {
const searchParams = new URL(req.url).searchParams;
let value = searchParams.get("todo");
rodrigotello avatar
valTownDailyInspo
@rodrigotello
An interactive, runnable TypeScript val by rodrigotello
Script
import { valTownInspirationEmail } from "https://esm.town/v/rodrigotello/valTownInspirationEmail";
export async function valTownDailyInspo() {
return await valTownInspirationEmail();
pomdtr avatar
freeform
@pomdtr
An interactive, runnable TypeScript val by pomdtr
Script
const style = document.createElement("style");
style.innerText =
s,monospace}.observablehq--collapsed,.observablehq--expanded,.observablehq--function,.observablehq--gray,.observablehq--impor
document.head.appendChild(style);
export function display(val) {
const d = document.body.appendChild(document.createElement("div"));
const inspector = new Inspector(d);
claytn avatar
createReplitDBClient
@claytn
NOTE: THIS CLIENT DOES NOT WORK AS EXPECTED. ALL VALS IN VAL TOWN ARE JSON.stringify-ied SO RETURNED CLOSURES AREN'T SUPPORTED USE THE INDIVIDUAL FUNCTIONS INSTEAD: @claytn.replitGet @claytn.replitSet @claytn.replitDelete @claytn.replitList
Script
THIS CLIENT DOES NOT WORK AS EXPECTED. ALL VALS IN VAL TOWN
ARE JSON.stringify-ied SO RETURNED CLOSURES AREN'T SUPPORTED
USE THE INDIVIDUAL FUNCTIONS INSTEAD:
@claytn.replitGet
@claytn.replitSet
@claytn.replitList
/** Database client for replit's key-value store */
export function createReplitDBClient(REPLIT_DB_URL) {
return {
get: (key) => {
mur avatar
honestAquaAsp
@mur
An interactive, runnable TypeScript val by mur
HTTP
export default async function (req: Request): Promise<Response> {
return Response.json({ ok: true })
pomdtr avatar
codemirror_web_component
@pomdtr
An interactive, runnable TypeScript val by pomdtr
HTTP
</body>
</html>`;
export default function(req: Request) {
return new Response(
html,
seanttaylor avatar
stub_user_storage_response
@seanttaylor
An interactive, runnable TypeScript val by seanttaylor
Script
export function stub_user_storage_response() {
return {
"hash": "e218fc4c0fec64514e13870a081687f239843df40142cb0f104dec3f3c5682a1",
ryan11js avatar
joke_generator
@ryan11js
// Fetches a random joke.
Cron
import { email } from "https://esm.town/v/std/email?v=9";
// Fetches a random joke.
async function fetchRandomJoke() {
const response = await fetch(
"https://official-joke-api.appspot.com/random_joke",
elliotbraem avatar
scheduler
@elliotbraem
An interactive, runnable TypeScript val by elliotbraem
HTTP
export default async function server(request: Request): Promise<Response> {
function initializeDayDropdowns() {
async function loadCalendars() {
async function createCalendar() {
async function deleteCalendar(id) {
async function viewCalendar(id) {
function createCalendarGrid() {
async function loadAvailability() {
async function toggleAvailability(day, time) {
function updateCalendarDisplay() {
stevekrouse avatar
decoratorsExample
@stevekrouse
An interactive, runnable TypeScript val by stevekrouse
Script
function logged() {
return function(
target: any,
const methodName = String(context.name);
return function(this: any, ...args: any[]) {
console.log(`Calling method ${methodName}`);
return target.call(this, ...args);
return `Hello, ${name}!`;
export default function testDecorators() {
const instance = new TestClass();
janpaul123 avatar
valle_tmp_701816702132716405607952805626981
@janpaul123
// Initialize sample stories and store them in blob storage
HTTP
// Initialize sample stories and store them in blob storage
const SAMPLE_STORIES_KEY = "hn_sample_stories";
async function initializeSampleStories() {
const existingStories = await blob.getJSON(SAMPLE_STORIES_KEY);
if (!existingStories) {
janpaul123 avatar
valle_tmp_83716651590775468527683084521698
@janpaul123
// This val responds with a funky "Hello, world!" HTML page with gradient background
HTTP
// This val responds with a funky "Hello, world!" HTML page with gradient background
export default async function main(req: Request): Promise<Response> {
const html = `
<html>