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=811&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 8401 results for "function"(480ms)

readabilityHTTPProxymain.tsx2 matches

@nbbaier•Updated 1 year ago
56};
57
58export default async function(req: Request): Promise<Response> {
59 const JSDOM = jsdom.JSDOM;
60 const url = new URL(req.url);
77
78 <script>
79 document.getElementById('nameForm').onsubmit = function(event) {
80 event.preventDefault();
81 const targetURL = document.getElementById("name").value

dateme_sqlitemain.tsx3 matches

@stevekrouse•Updated 1 year ago
4import { thisWebURL } from "https://esm.town/v/stevekrouse/thisWebURL";
5
6export function createTable() {
7 return sqlite.execute(`
8 CREATE TABLE IF NOT EXISTS DateMeDocs (
29 (:Id, :Name, :Profile, :Gender, :Age, :Contact, :LastUpdated, :InterestedIn, :Location, :Style, :LocationFlexibility, :Community)`;
30
31export default async function() {
32 let docs = await getDocs();
33 return Response.json(docs);
34}
35
36export async function setupDatabase() {
37 await createTable();
38 const docs = await fetchJSON(thisWebURL());

apricotSlothmain.tsx1 match

@tmcw•Updated 1 year ago
4
5const { result } = core.runJavascript({
6 code: "function name() { return \"Hello\"; }",
7 "name": "name",
8});

date_me_docs_tablemain.tsx3 matches

@stevekrouse•Updated 1 year ago
17];
18
19function httpsIfy(url: string) {
20 if (!url.startsWith("http://") && !url.startsWith("https://")) {
21 return `https://${url}`;
24}
25
26function renderCell(header, row) {
27 let data = row[header];
28 if (header === "Name") {
38}
39
40export async function docs_table() {
41 const docs = await getDocs();
42 return (

dateme_layoutmain.tsx1 match

@stevekrouse•Updated 1 year ago
4const tabs = { "/": "Home", "/browse": "Browse", "/faq": "FAQ" };
5
6export default function({ activeTab, children }: PropsWithChildren<{ activeTab: string }>) {
7 return (
8 <html>

dateme_homemain.tsx1 match

@stevekrouse•Updated 1 year ago
4import Layout from "https://esm.town/v/stevekrouse/dateme_layout";
5
6export default function Home(c) {
7 return c.html(
8 <Layout activeTab={new URL(c.req.url).pathname}>

tanChimpanzeemain.tsx1 match

@stevekrouse•Updated 1 year ago
2import { reloadOnSaveMiddleware } from "https://esm.town/v/stevekrouse/reloadOnSave";
3
4export default reloadOnSaveMiddleware(async function(req: Request): Promise<Response> {
5 return html(`<h1>Hello 3!!</h1>`);
6});

ReloadScriptmain.tsx1 match

@stevekrouse•Updated 1 year ago
3import { parentReference } from "https://esm.town/v/stevekrouse/parentReference";
4
5export const reloadOnVals = async function(vals: { userHandle: string; valName: string }[]) {
6 const valVersions = await Promise.all(vals.map(getCurrentValVersionNumber));
7 // console.log("initialValVersions: ", valVersions);

getCurrentValVersionNumbermain.tsx1 match

@stevekrouse•Updated 1 year ago
4 * @param {string} valSlug - ie "username/valname"
5 */
6export async function getCurrentValVersionNumber({ name, handle }) {
7 const { version } = await alias({ username: handle, valName: name });
8 return version;

reloadOnSaveREADME.md1 match

@stevekrouse•Updated 1 year ago
9import { reloadOnSaveFetchMiddleware } from "https://esm.town/v/stevekrouse/reloadOnSave";
10
11export default reloadOnSaveFetchMiddleware(async function(req: Request): Promise<Response> {
12 return html(`<h1>Hello!!</h1>`);
13})

getFileEmail4 file matches

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

TwilioHelperFunctions

@vawogbemi•Updated 2 months ago