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=59&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 8272 results for "function"(326ms)

twitterCardsmain.tsx1 match

@nbbaier•Updated 6 days ago
15}
16
17export default async function (req: Request): Promise<Response> {
18 const url =
19 "https://publish.twitter.com/oembed?url=https%3A%2F%2Ftwitter.com%2FInterior%2Fstatus%2F507185938620219395";

dbToAPI_backupserver.tsx1 match

@nbbaier•Updated 6 days ago
11
12// TODO: implement options
13export async function createServer(db, options: Options & { auth?: { username: string; password: string } } = {}) {
14 const app = new Hono();
15

FarcasterMiniAppStoreHome.tsx3 matches

@moe•Updated 6 days ago
9import { useQuery } from "../util/useQuery.ts";
10
11export function Home() {
12 const [context, setContext] = useState<any>();
13 useEffect(() => {
36}
37
38function MiniApps() {
39 const { data: miniapps } = useQuery(["miniapps"], async () => {
40 // return await fetch(`/api/miniapps`).then(r => r.json()).then(r => r);
124}
125
126function MiniApp({ miniapp }) {
127 const navigate = useNavigate();
128 // console.log(miniapp.manifest?.frame?.name);
pie

piemain.tsx1 match

@jxnblk•Updated 1 week ago
12const dashArray = n => `${(R * Math.PI * n)} ${Math.PI * R}`;
13
14export default async function(req: Request): Promise<Response> {
15 const params = new URL(req.url).searchParams;
16 const { values, ...args } = Object.fromEntries(params);
the-juice

the-juicetragic-indigo-gopher3 matches

@jxnblk•Updated 1 week ago
11 * The main App component is rendered on the client.
12 */
13function App() {
14 const [splats, setSplats] = useState([]);
15 const [shake, setShake] = useState(false);
82
83// Client-side only code
84function client() {
85 createRoot(document.getElementById("root")).render(<App />);
86}
88
89// Server-side only code
90export default async function server(request: Request): Promise<Response> {
91 return new Response(`
92 <!DOCTYPE html>
the-juice

the-juicestill-olive-barnacle7 matches

@jxnblk•Updated 1 week ago
1/**
2 * This program implements a simple Wave Function Collapse algorithm to generate
3 * a random game world rendered in ASCII characters with different colors.
4 * It uses React for the client-side rendering and handles the generation
18};
19
20function App() {
21 const [world, setWorld] = useState([]);
22
47}
48
49function client() {
50 createRoot(document.getElementById("root")).render(<App />);
51}
53if (typeof document !== "undefined") { client(); }
54
55async function server(request: Request): Promise<Response> {
56 const url = new URL(request.url);
57
79}
80
81function generateWorld(height: number, width: number): string[][] {
82 const world = Array(height).fill(0).map(() => Array(width).fill(null));
83 const stack: [number, number][] = [];
118}
119
120function getRandomTile(): string {
121 const tiles = Object.keys(tileTypes);
122 return tiles[Math.floor(Math.random() * tiles.length)];
123}
124
125function getPossibleTiles(world: string[][], y: number, x: number): string[] {
126 const neighbors = [
127 world[y - 1]?.[x],
the-juice

the-juiceresponsible-aqua-orca1 match

@jxnblk•Updated 1 week ago
2// We'll use a basic HTML structure with inline CSS for styling.
3
4export default async function server(request: Request): Promise<Response> {
5 const html = `
6 <!DOCTYPE html>
the-juice

the-juicejuicy-number-20493 matches

@jxnblk•Updated 1 week ago
3import { createRoot } from "https://esm.sh/react-dom/client";
4
5function App() {
6 return (
7 <div style={{
19}
20
21function client() {
22 createRoot(document.getElementById("root")).render(<App />);
23}
24if (typeof document !== "undefined") { client(); }
25
26export default async function server(request: Request): Promise<Response> {
27 return new Response(`
28 <html>
the-juice

the-juiceholy-black-bedbug2 matches

@jxnblk•Updated 1 week ago
90// Hoisted JavaScript
91if (typeof document !== "undefined") {
92 function createBubbles() {
93 for (let i = 0; i < 20; i++) {
94 const bubble = document.createElement('div');
140);
141
142export default async function server(request: Request): Promise<Response> {
143 const html = renderToString(<App />);
144
the-juice

the-juicehello-kitty3 matches

@jxnblk•Updated 1 week ago
3import { createRoot } from "https://esm.sh/react-dom/client";
4
5function App() {
6 return (
7 <div className="container">
24}
25
26function client() {
27 createRoot(document.getElementById("root")).render(<App />);
28}
29if (typeof document !== "undefined") { client(); }
30
31export default async function server(request: Request): Promise<Response> {
32 return new Response(`
33 <html>

getFileEmail4 file matches

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

TwilioHelperFunctions

@vawogbemi•Updated 2 months ago