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/$%7Burl%7D?q=function&page=5&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 18147 results for "function"(1616ms)

hellooooooomarkdown-tips.md1 match

@charmaine•Updated 7 hours ago
15
16```javascript
17function hello() {
18 console.log("Hello, world!");
19}

blogggggindex.ts6 matches

@charmaine•Updated 7 hours ago
82});
83
84// Helper function to list blog posts
85async function listBlogPosts() {
86 try {
87 const posts = [];
106}
107
108// Helper function to get a blog post by slug
109async function getBlogPost(slug: string) {
110 try {
111 const filePath = `/content/posts/${slug}.md`;
133}
134
135// Helper function to parse frontmatter
136function parseFrontmatter(content: string) {
137 const frontmatterRegex = /^---\s*([\s\S]*?)\s*---\s*([\s\S]*)$/;
138 const match = content.match(frontmatterRegex);

blogggggREADME.md1 match

@charmaine•Updated 7 hours ago
66- Add pagination for blog listings
67- Implement categories in addition to tags
68- Add search functionality
69- Support for images in blog posts
70- RSS feed generation

blogggggmarkdown-guide.md1 match

@charmaine•Updated 7 hours ago
80````markdown
81```javascript
82function example() {
83 return "Hello, world!";
84}

bloggggghello-world.md2 matches

@charmaine•Updated 7 hours ago
23## Code Example
24
25Here's a simple JavaScript function:
26
27```javascript
28function greet(name) {
29 return `Hello, ${name}!`;
30}

blogggggpost.html2 matches

@charmaine•Updated 7 hours 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 7 hours 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 7 hours 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 7 hours 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 7 hours 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

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": "*",