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/image-url.jpg%20%22Image%20title%22?q=function&page=2388&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 25661 results for "function"(1540ms)

constructReadTangleUrlmain.tsx1 match

@willthereader•Updated 1 year ago
1import { logMessage } from "https://esm.town/v/willthereader/logMessage";
2
3// Immediately invoked function that exports a function generating a URL as a string,
4// which fetches all comments from an article associated with the provided post_id.
5export const constructReadTangleUrl = (() => {

date_me_docs_tablemain.tsx2 matches

@skyehersh•Updated 1 year ago
17];
18
19function renderCell(header, row) {
20 let data = row[header];
21 if (header === "Name") {
31}
32
33export async function docs_table() {
34 const docs = await getDocs();
35 return (

dataTableScriptmain.tsx1 match

@skyehersh•Updated 1 year ago
6const styleEl = document.getElementById("style");
7
8DataTable.ext.search.push(function(settings, data, dataIndex) {
9 let min = parseInt(minEl.value, 10);
10 let max = parseInt(maxEl.value, 10);

getThreadsActivitymain.tsx3 matches

@stevekrouse•Updated 1 year ago
11});
12
13async function getKnownThreads() {
14 const result = await db.select().from(threadsTbl);
15 return result.reduce((r, { id, last_message_id }) => {
19}
20
21async function getNewThreads() {
22 const resp = await fetch(`https://discord.com/api/guilds/${guild}/threads/active`, {
23 headers: {
34}
35
36export async function getThreadsActivity(
37 token: string,
38 guild: string,

dataTableScriptmain.tsx1 match

@stevekrouse•Updated 1 year ago
4const desiredGenderEl = document.getElementById("desired-gender");
5
6DataTable.ext.search.push(function(settings, data, dataIndex) {
7 let min = parseInt(minEl.value, 10);
8 let max = parseInt(maxEl.value, 10);

auth_middlewaremain.tsx5 matches

@stevekrouse•Updated 1 year ago
28</html>`;
29
30export function redirect(location: string): Response {
31 return new Response(null, {
32 headers: {
37}
38
39function generateAccessToken(user) {
40 return jwt.sign(user, process.env.ACCESS_TOKEN_SECRET, { expiresIn: "1800s" });
41}
46};
47
48async function fetchUser(token: string): Promise<User> {
49 const resp = await fetch("https://api.val.town/v1/me", {
50 headers: {
60}
61
62function signout() {
63 const res = redirect("/");
64 cookie.setCookie(res.headers, {
73}
74
75export function auth(handler) {
76 const secretKey = Deno.env.get("AUTH_SECRET_KEY");
77 if (!secretKey) {

auth_middlewareREADME.md1 match

@stevekrouse•Updated 1 year ago
14import { auth } from "https://esm.town/v/pomdtr/auth_middleware";
15
16async function handler(req: Request): Promise<Response> {
17 return new Response("You are authenticated!");
18}

test_authmain.tsx1 match

@pomdtr•Updated 1 year ago
1import { auth } from "https://esm.town/v/pomdtr/auth_middleware";
2
3async function handler(req: Request): Promise<Response> {
4 return new Response("You are authenticated!");
5}

sqlitemain.tsx2 matches

@saolsen•Updated 1 year ago
6import { get_tracer } from "https://esm.town/v/saolsen/tracing?v=136";
7
8async function traced_execute(statement: InStatement): Promise<ResultSet> {
9 return await get_tracer().startActiveSpan(`sqlite:execute`, async (span) => {
10 if (span.isRecording()) {
41}
42
43async function traced_batch(statements: InStatement[], mode?: TransactionMode): Promise<ResultSet[]> {
44 return await get_tracer().startActiveSpan(`sqlite:batch`, async (span) => {
45 if (span.isRecording()) {

fetchPaginatedDataREADME.md1 match

@nbbaier•Updated 1 year ago
1# Fetch Paginated Data
2
3This val exports a function that loops through paginated API responses and returns the combined data as an array. It expects pagination with `next` and there to be a `data` property in the API response. This conforms to the Val Town API, so this function is useful when fetching paginated Val Town API responses for creating custom folders in [pomdtr's vscode extension](https://github.com/pomdtr/valtown-vscode).
4
5Usage:

getFileEmail4 file matches

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

tuna8 file matches

@jxnblk•Updated 1 month 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.