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=2725&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 29317 results for "function"(5439ms)

sqliteBuilderBetamain.tsx1 match

@postpostscript•Updated 1 year ago
83}
84
85export function Statement(
86 strings: TemplateStringsArray,
87 ...replacements: (InValue | StatementInstance)[]

extractImportsmain.tsx2 matches

@pomdtr•Updated 1 year ago
2import ts from "npm:typescript";
3
4export function extractImports(code: string): string[] {
5 const sourceFile = ts.createSourceFile(
6 "val.ts",
10 const imports = [];
11
12 function visitNode(node: ts.Node) {
13 if (ts.isImportDeclaration(node)) {
14 const importClause = node.importClause;

webhookHandlermain.tsx1 match

@mux•Updated 1 year ago
8});
9
10export default async function(req: Request): Promise<Response> {
11 if (req.method === "GET") {
12 return Response.json({ ignored: true });

blogSqliteUniversePart2main.tsx1 match

@postpostscript•Updated 1 year ago
2import { getValEndpointFromName } from "https://esm.town/v/postpostscript/meta";
3
4export default function(req: Request) {
5 const { author, name } = extractValInfo(import.meta.url);
6 const blogEndpoint = getValEndpointFromName(`@${author}/blog`);

videoStorageREADME.md1 match

@mux•Updated 1 year ago
7At least these are how we use them in the `webhookHandler`
8
9| Function | Mux Event | Note |
10|------------------|-------------------|-------------------------------|
11| `createVideo()` | `video.upload.created` | Triggered when a direct upload is initially created |

manifold_daily_loan_collectormain.tsx1 match

@jackc•Updated 1 year ago
1export default async function() {
2 const res = await fetch("https://api.manifold.markets/request-loan", {
3 headers: {

valtownToSQLitemain.tsx3 matches

@postpostscript•Updated 1 year ago
33);`;
34
35function valToRow(val: Val) {
36 return [
37 val.id,
49}
50
51async function insertRows(rows, options: { sqlite: SqliteInterface } = { sqlite }) {
52 const query =
53 sql`INSERT OR REPLACE INTO vals (id, name, code, version, privacy, public, run_start_at, run_end_at, created_at, author_id, author_username) VALUES ${
58}
59
60export async function valtownToSQLite(options: { sqlite: SqliteInterface } = { sqlite }) {
61 await options.sqlite.execute(createQuery);
62 let url = "https://api.val.town/v1/search/vals?query=%20&limit=100";

createmain.tsx1 match

@websandbox•Updated 1 year ago
1export async function create({ code, token }: { code: string; token: string }) {
2 const { error, details, url } = await (await fetch("https://websandbox-createAPI.web.val.run", {
3 body: JSON.stringify({ code, token }),

cleanupmain.tsx1 match

@websandbox•Updated 1 year ago
4import { EXPIRY } from "https://esm.town/v/websandbox/config";
5
6export default async function(interval: Interval) {
7 for (const b of await blob.list("play_")) {
8 if ((new Date(b.lastModified).valueOf() + EXPIRY) < Date.now()) {

sudoku_solver_human_searchmain.tsx5 matches

@saolsen•Updated 1 year ago
19type Constraint = { cell: Cell; value: Val };
20
21function constrainRow(possible_values: PossibleValues, row: number, value: Val): Constraint[] {
22 const constrained: Constraint[] = [];
23 for (let col = 0; col < 9; col++) {
31}
32
33function constrainCol(possible_values: PossibleValues, col: number, value: Val): Constraint[] {
34 const constrained: Constraint[] = [];
35 for (let row = 0; row < 9; row++) {
43}
44
45function constrainBox(possible_values: PossibleValues, row: number, col: number, value: Val): Constraint[] {
46 const constrained: Constraint[] = [];
47 const box_row = Math.floor(row / 3);
59}
60
61function undoConstraints(possible_values: PossibleValues, constraints: Constraint[]) {
62 for (const { cell: { row, col }, value } of constraints) {
63 possible_values[row][col]!.add(value);
66
67// Lets try a "solve like a human" algorithm.
68export function solve(sudoku: Sudoku): Sudoku | null {
69 sudoku = Sudoku.parse(sudoku);
70
tuna

tuna9 file matches

@jxnblk•Updated 1 day ago
Simple functional CSS library for Val Town

getFileEmail4 file matches

@shouser•Updated 1 month ago
A helper function to build a file's email
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.