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/$%7Bsuccess?q=function&page=23&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 18318 results for "function"(856ms)

blogggggpost.html2 matches

@charmaine•Updated 1 day ago
48 const post = window.__INITIAL_DATA__?.post;
49
50 function renderPost() {
51 if (!post) {
52 window.location.href = '/';
75 }
76
77 function formatDate(dateString) {
78 try {
79 const date = new Date(dateString);

blogggggindex.html2 matches

@charmaine•Updated 1 day ago
25 const posts = window.__INITIAL_DATA__?.posts || [];
26
27 function renderPosts() {
28 const container = document.getElementById('posts-container');
29
51 }
52
53 function formatDate(dateString) {
54 try {
55 const date = new Date(dateString);

untitled-5953test.tsx8 matches

@phintech•Updated 1 day ago
31
32// Client-side application
33function BattleTechApp() {
34 const [mechs, setMechs] = createSignal<Mech[]>([]);
35 const [selectedMechId, setSelectedMechId] = createSignal<string | null>(null);
104 };
105
106 function addMech() {
107 const newMech: Mech = {
108 id: crypto.randomUUID(),
118 }
119
120 function removeMech(id: string) {
121 setMechs(mechs().filter(m => m.id !== id));
122 if (selectedMechId() === id) {
125 }
126
127 function addWeapon(weaponId: string) {
128 const mech = selectedMech();
129 if (!mech) return;
146 }
147
148 function removeWeapon(mechId: string, weaponId: string) {
149 setMechs(
150 mechs().map(m => {
157 }
158
159 function fireWeapon(mechId: string, weaponId: string) {
160 setMechs(
161 mechs().map(m => {
187 }
188
189 function dissipateHeat() {
190 setMechs(
191 mechs().map(m => {
197 }
198
199 function resetAmmo(mechId: string, weaponId: string) {
200 setMechs(
201 mechs().map(m => {

TownieuseUsageStats.ts1 match

@valdottown•Updated 1 day ago
1import { useEffect } from "https://esm.sh/react@18.2.0?dev";
2
3export function useUsageStats (messages: any[], usages: any[]) {
4 useEffect(() => {
5 if (!messages?.length) return;

TownieuseScrollToBottom.tsx3 matches

@valdottown•Updated 1 day ago
7 *
8 * @param {Array} dependencies - Array of dependencies that trigger scrolling when changed
9 * @returns {Object} An object containing containerRef and scrollToBottom function
10 */
11export function useScrollToBottomContainer(dependencies = []) {
12 const containerRef = useRef(null);
13
28
29// body scroll version
30export function useScrollToBottom(dependencies = []) {
31 const bottomRef = useRef(null);
32

TownieuseProject.tsx1 match

@valdottown•Updated 1 day ago
5const FILES_ENDPOINT = "/api/project-files";
6
7export function useProject (projectId: string, branchId?: string) {
8 const { token } = useAuth();
9 const [data, setData] = useState<any>(null);

TownieuseProjects.tsx1 match

@valdottown•Updated 1 day ago
4const ENDPOINT = "/api/projects-loader";
5
6export function useProjects () {
7 const { token } = useAuth();
8 const [data, setData] = useState<any>(null);

TownieuseLoadingFavicon.ts3 matches

@valdottown•Updated 1 day ago
1import { useEffect } from "https://esm.sh/react@18.2.0?dev";
2
3function setLoadingFavicon() {
4 document.querySelector('link[rel="icon"]').href = "/favicon-loading.svg";
5}
6function resetFavicon () {
7 document.querySelector('link[rel="icon"]').href = "/favicon.svg";
8}
9
10export function useLoadingFavicon (loading: boolean) {
11 useEffect(() => {
12 if (loading) setLoadingFavicon();

TownieuseCreateProject.tsx1 match

@valdottown•Updated 1 day ago
5const ENDPOINT = "/api/create-project";
6
7export function useCreateProject () {
8 const { token } = useAuth();
9 const [data, setData] = useState<any>(null);

TownieuseCreateBranch.tsx1 match

@valdottown•Updated 1 day ago
4const ENDPOINT = "/api/create-branch";
5
6export function useCreateBranch (projectId: string) {
7 const { token } = useAuth();
8 const [data, setData] = useState<any>(null);

getFileEmail4 file matches

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