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/$%7Bart_info.art.src%7D?q=function&page=1734&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 17976 results for "function"(1531ms)

selfEmbeddedNoFrameworkmain.tsx10 matches

@liamdanielduffy•Updated 1 year ago
1// https://www.val.town/embed/liamdanielduffy.selfEmbedded
2export async function selfEmbeddedNoFramework(
3 req: express.Request,
4 res: express.Response,
63 });
64
65 function makeResizable(element) {
66 const resizer = document.createElement('div');
67 resizer.className = 'drag-handle bottom-right-handle';
72 resizer.addEventListener('mousedown', initResize, false);
73
74 function initResize(e) {
75 startX = e.clientX;
76 startY = e.clientY;
83 }
84
85 function resize(e) {
86 const width = startWidth + e.clientX - startX;
87 const height = startHeight + e.clientY - startY;
92 }
93
94 function stopResize() {
95 document.documentElement.removeEventListener('mousemove', resize, false);
96 document.documentElement.removeEventListener('mouseup', stopResize, false);
98 }
99
100 function makeDraggable(element) {
101 const topHandle = element.querySelector('.top-handle');
102 const iframe = element.querySelector('iframe');
104 topHandle.addEventListener('mousedown', startDrag, false);
105
106 function startDrag(e) {
107 e.preventDefault();
108 let startY = e.clientY;
112 document.documentElement.addEventListener('mouseup', stopDrag, false);
113
114 function drag(e) {
115 const deltaY = e.clientY - startY;
116 const newTop = startTop + deltaY;
118 }
119
120 function stopDrag() {
121 document.documentElement.removeEventListener('mousemove', drag, false);
122 document.documentElement.removeEventListener('mouseup', stopDrag, false);
125
126 // Prevent iframe interaction while dragging
127 iframe.addEventListener('mousedown', function (e) {
128 e.stopPropagation();
129 });

helloWorldmain.tsx1 match

@liamdanielduffy•Updated 1 year ago
1export function helloWorld() {
2 return "hello world";
3}

reactTodoListWebsitemain.tsx1 match

@liamdanielduffy•Updated 1 year ago
4
5// https://api.val.town/v1/express/liamdanielduffy.reactTodoListWebsite
6export function reactTodoListWebsite(req, res) {
7 res.set("Content-Type", "text/html");
8 res.send(buildHtml({

myApimain.tsx1 match

@dotangad•Updated 1 year ago
1export function myApi(name) {
2 return "hi " + name;
3}

myApimain.tsx1 match

@dgiulian•Updated 1 year ago
1export function myApi(name) {
2 return "hi " + name;
3}

ankiNudgemain.tsx1 match

@petermillspaugh•Updated 1 year ago
1import { email } from "https://esm.town/v/std/email?v=9";
2
3export async function ankiNudge() {
4 const today = new Date();
5 const todayDate = new Intl.DateTimeFormat("en-US", { dateStyle: "long" })

wttrAstronomyDatamain.tsx1 match

@rwev•Updated 1 year ago
9};
10export type AstronomyData = AstronomyPoint[];
11export async function wttrAstronomyData(
12 wttrJson: any // return of @me.wttrJson
13): Promise<AstronomyData> {

adjustMsToWeekdaymain.tsx1 match

@rwev•Updated 1 year ago
2import { msDay as msDay2 } from "https://esm.town/v/stevekrouse/msDay?v=1";
3
4export function adjustMsToWeekday(msDay) {
5 let date = new Date(msDay);
6 while (date.getDay() == 0 || date.getDay() == 6) {

myApimain.tsx1 match

@thyme•Updated 1 year ago
1export function myApi(name) {
2 return "hiii " + name;
3}

myApimain.tsx1 match

@deverts•Updated 1 year ago
1import { myCt } from "https://esm.town/v/deverts/myCt";
2
3export function myApi(name, age) {
4 return "hi " + name + " " + age + " (" + myCt + ")";
5}

getFileEmail4 file matches

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

tuna8 file matches

@jxnblk•Updated 1 week 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": "*",