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=1648&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 18944 results for "function"(2611ms)

sendNotificationREADME.md1 match

@gwoods22•Updated 1 year ago
3This val can be used in other vals to send notifications to a segment using [OneSignal's REST API](https://documentation.onesignal.com/reference/create-notification)
4
5This is really handy if you want to send push notifications to your phone without building a native app! I built a barebones React PWA that asks for a password then loads the OneSignal Web SDK that I deployed to [Netlify](https://www.netlify.com/) for free. OneSignal has [easy to follow docs](https://documentation.onesignal.com/docs/web-sdk-setup) so you can build this functionality into a React, Angular, Vue app or even Wordpress! Then [install the PWA](https://www.bitcot.com/how-to-install-a-pwa-to-your-device/) on your platform of choice and you're off to the races!
6
7## Setup

ctanPackageNamesmain.tsx1 match

@aleaf•Updated 1 year ago
1export default async function(req: Request): Promise<Response> {
2 const response = await fetch("https://ctan.org/json/2.0/packages");
3 const packages = await response.json();

googleFeelingLuckymain.tsx6 matches

@vladimyr•Updated 1 year ago
5 "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36";
6
7export default async function(req: Request): Promise<Response> {
8 const { searchParams } = new URL(req.url);
9 const query = searchParams.get("q");
17}
18
19export function search(query: string, userAgent = DEFAULT_USER_AGENT) {
20 const searchUrl = createSearchUrl(query);
21 return getRedirectUrl(searchUrl, userAgent);
22}
23
24export function createSearchUrl(query: string, buttonName = "") {
25 const searchURL = new URL("https://www.google.com/search");
26 searchURL.searchParams.set("q", query);
29}
30
31export async function getRedirectUrl(searchUrl: string | URL, userAgent = DEFAULT_USER_AGENT) {
32 const resp = await ky.get(searchUrl, { headers: { "user-agent": userAgent } });
33 const { searchParams } = new URL(resp.url);
36}
37
38export async function signSearchUrl(searchUrl: string | URL) {
39 const signedURL = new URL(searchUrl);
40 const params = await getSearchParams();
43}
44
45export async function getSearchParams(userAgent = DEFAULT_USER_AGENT) {
46 await initParser();
47 const html = await ky.get("https://www.google.com", { headers: { "user-agent": userAgent } }).text();

fetchWorkermain.tsx2 matches

@postpostscript•Updated 1 year ago
6workerURL.searchParams.set("worker", "1");
7
8export async function fetchWorker(opts: {
9 url: string;
10 handler?: string;
83}
84
85export function setupWorker() {
86 let handler: (req: Request) => Promise<Response>;
87

userAgentsmain.tsx1 match

@alexbowe•Updated 1 year ago
102];
103
104export function getRandomUserAgent() {
105 const i = Math.floor(Math.random() * USER_AGENTS.length);
106 return USER_AGENTS[i];

mdConvertmain.tsx1 match

@stevekrouse•Updated 1 year ago
9});
10
11export default async function handler(request: Request) {
12 if (request.method !== "POST") {
13 return html(`

magentaMarlinmain.tsx1 match

@Joelsrubin•Updated 1 year ago
2import { set } from "https://esm.town/v/std/set?v=11";
3
4export async function signGuestBook(message) {
5 guestBook.unshift(message);
6 await set("guestBook", guestBook);

codepen_debugmain.tsx1 match

@g•Updated 1 year ago
1import { parseCodepen } from "https://esm.town/v/g/parseCodepen";
2
3export default async function(req: Request): Promise<Response> {
4 const url = new URL(req.url);
5 const id = url.pathname.slice(1);

deeplinkmain.tsx1 match

@pomdtr•Updated 1 year ago
1export default function(req: Request) {
2 const url = new URL(req.url);
3 if (!url.searchParams.has("url")) {

cmdk_v1main.tsx3 matches

@pomdtr•Updated 1 year ago
18};
19
20export function defineExtension(manifest: {
21 title: string;
22 actions: ActionItem[];
35}
36
37export function defineCommand(command: Command) {
38 return command;
39}
40
41export function cmdk(config: {
42 extensions?: Extension[];
43 actions?: ActionItem[];

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
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": "*",
webup
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.