Val Town Code SearchReturn to Val Town

API Access

You can access search results via JSON API by adding format=json to your query:

https://codesearch.val.run/?q=function&page=1577&format=json

For typeahead suggestions, use the /typeahead endpoint:

https://codesearch.val.run/typeahead?q=function

Returns an array of strings in format "username" or "username/projectName"

Found 18580 results for "function"(3438ms)

threedEmojimain.tsx2 matches

@iamseeley•Updated 11 months ago
1import * as THREE from 'https://cdn.skypack.dev/three@0.128.0';
2
3export function create3DEmoji(emoji, width, height) {
4 // canvas element
5 const canvas = document.createElement('canvas');
57
58 // animation loop
59 function animate() {
60 requestAnimationFrame(animate);
61

asciiImageExamplemain.tsx1 match

@maxm•Updated 11 months ago
1import { imageToAscii } from "https://esm.town/v/maxm/imageToAscii";
2
3export default async function(req: Request): Promise<Response> {
4 const { string, stringColor } = await imageToAscii(
5 "https://webcams.nyctmc.org/api/cameras/9fa5b0dd-e955-449e-97e1-9c53ad9c23a8/image",

pollRSSFeedsmain.tsx1 match

@squirals•Updated 11 months ago
3import { newRSSItems } from "https://esm.town/v/stevekrouse/newRSSItems";
4
5export async function pollRSSFeeds({ lastRunAt }: Interval) {
6 return Promise.all(
7 Object.entries(rssFeeds).map(async ([name, url]) => {

geolocation_api_demomain.tsx4 matches

@stevekrouse•Updated 11 months ago
1import { html } from "https://esm.town/v/stevekrouse/html";
2
3export default async function (req: Request): Promise<Response> {
4 return html(`
5 <button id="find-me">Show my location</button><br />
7 <a id="map-link" target="_blank"></a>
8 <script>
9 function geoFindMe() {
10 const status = document.querySelector("#status");
11 const mapLink = document.querySelector("#map-link");
14 mapLink.textContent = "";
15
16 function success(position) {
17 const latitude = position.coords.latitude;
18 const longitude = position.coords.longitude;
23 }
24
25 function error() {
26 status.textContent = "Unable to retrieve your location";
27 }

threedEmojiREADME.md1 match

@iamseeley•Updated 11 months ago
8```
9
10call the function after the DOM has loaded
11```JavaScript
12import { create3DEmoji } from 'https://esm.town/v/iamseeley/threedEmoji';

imageToAsciimain.tsx1 match

@maxm•Updated 11 months ago
26// Converted from: https://github.com/victorqribeiro/imgToAscii/blob/ca7e181b9bb9770798ed3a0d3dfeb344c60953f2/src/imgToAscii.js
27import { createCanvas, loadImage } from "https://deno.land/x/canvas@v1.4.1/mod.ts";
28export async function imageToAscii(src: string, maxWidth?: number) {
29 let string = "";
30 let stringColor = "";

createTursoProxymain.tsx1 match

@pomdtr•Updated 11 months ago
2import { createClient } from "npm:@libsql/client";
3
4export function createTursoProxy(databaseUrl: string, authToken: string) {
5 const client = createClient({
6 url: `${databaseUrl}?authToken=${Deno.env.get("TURSO_AUTH_TOKEN")}`,

circlesmain.tsx6 matches

@pomdtr•Updated 11 months ago
37// });
38
39function parseResultSet<T>(row: ResultSet): T[] {
40 return row.rows.map((r) => Object.fromEntries(r.map((c, i) => [row.columns[i], c]))) as T[];
41}
51};
52
53function diffCircles(array1: Circle[], array2: Circle[]): Circle[] {
54 const changes: Circle[] = [];
55
74
75 const drag = (() => {
76 function dragstarted() {
77 d3.select(this).attr("stroke", "black");
78 }
79
80 function dragged(event, d) {
81 d3.select(this).raise().attr("cx", d.x = event.x).attr("cy", d.y = event.y);
82 }
83
84 function dragended() {
85 const x = d3.select(this).attr("cx");
86 const y = d3.select(this).attr("cy");
105 .call(drag)
106 .on("click", clicked);
107 function clicked(event, d) {
108 if (event.defaultPrevented) return; // dragged
109

linkInBioTemplatemain.tsx1 match

@morsczx•Updated 11 months ago
2import { renderToString } from "npm:react-dom/server";
3
4export default async function(req: Request) {
5 return new Response(
6 renderToString(

dateme_faqmain.tsx1 match

@stevekrouse•Updated 11 months ago
6let linkClass = "text-sky-600 hover:text-sky-500";
7
8export default function FAQ(c) {
9 return c.html(
10 <Layout activeTab={new URL(c.req.url).pathname}>

getFileEmail4 file matches

@shouser•Updated 2 weeks ago
A helper function to build a file's email
tuna

tuna8 file matches

@jxnblk•Updated 2 weeks ago
Simple functional CSS library for Val Town
webup
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.
lost1991
import { OpenAI } from "https://esm.town/v/std/openai"; export default async function(req: Request): Promise<Response> { if (req.method === "OPTIONS") { return new Response(null, { headers: { "Access-Control-Allow-Origin": "*",