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=752&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 7802 results for "function"(1047ms)

visionaryPeachAspREADME.md1 match

@stevekrouse•Updated 4 months ago
1A proxy that lets Val Town users get some free [SocialData](https://socialdata.tools) Search to power their Twitter Alerts, ie @stevekrouse/twitterAlert
2
3I reccomend interfacing with this proxy via this helper function: @stevekrouse/socialDataSearch

spectacularAzureAngelfishmain.tsx4 matches

@stevekrouse•Updated 4 months ago
15type UsageData = { username: string; usage_count: number; date: string };
16
17function UsageDashboard() {
18 const [usageData, setUsageData] = useState<UsageData[]>([]);
19
20 useEffect(() => {
21 async function fetchUsageData() {
22 const response = await fetch('/usage-data');
23 const data = await response.json();
85}
86
87function client() {
88 createRoot(document.getElementById("root")).render(<UsageDashboard />);
89}
90if (typeof document !== "undefined") { client(); }
91
92export default async function(req: Request): Promise<Response> {
93 const url = new URL(req.url);
94

spectacularAzureAngelfishREADME.md1 match

@stevekrouse•Updated 4 months ago
1A proxy that lets Val Town users get some free [SocialData](https://socialdata.tools) Search to power their Twitter Alerts, ie @stevekrouse/twitterAlert
2
3I reccomend interfacing with this proxy via this helper function: @stevekrouse/socialDataSearch

LotecaV2main.tsx6 matches

@maxm•Updated 4 months ago
15// console.log(MEUS_JOGOS);
16
17function compareGames(drawnNumbers, userGame) {
18 return userGame.filter(num => drawnNumbers.includes(num)).length;
19}
20
21function TabelaDistribuicaoPremios({ premios }) {
22 if (!premios || premios.length === 0) return null;
23
51}
52
53function App() {
54 const [dadosLoteria, setDadosLoteria] = useState(null);
55 const [numeroAtual, setNumeroAtual] = useState(null);
56 const [erro, setErro] = useState(null);
57
58 async function buscarDadosLoteria(numero = null) {
59 const url = numero
60 ? `https://servicebus2.caixa.gov.br/portaldeloterias/api/megasena/${numero}`
195}
196
197function client() {
198 createRoot(document.getElementById("root")).render(<App />);
199}
200if (typeof document !== "undefined") { client(); }
201
202export default async function server(request: Request): Promise<Response> {
203 return new Response(
204 `

wideLibmain.tsx12 matches

@maxm•Updated 5 months ago
5const schemaVersion = 3;
6
7function _client() {
8 return createClient({
9 url: Deno.env.get("WIDE_CLICKHOUSE_URL"),
13}
14
15export async function runMigrations() {
16 for (
17 const migration of [
53 }
54}
55export function parseRows(rows: any[]) {
56 const processedRows = rows.map(row => {
57 const paths: {
65 };
66
67 function processObject(obj: any, currentPath = "") {
68 for (const [key, value] of Object.entries(obj)) {
69 const newPath = currentPath ? `${currentPath}.${key}` : key;
166 * write!
167 */
168export async function write(userId: string, data: any[]) {
169 return await writeRowsToClickhouse(userId, parseRows(data));
170}
182 * values!
183 */
184export async function values(
185 userId: string,
186 { field_name, field_type }: { field_name: string; field_type: FieldType },
218 * fields!
219 */
220export async function fields(userId: string, search: string = "") {
221 return (await (await _client().query({
222 query: `
296 * Get the ClickHouse comparison expression for the given operator
297 */
298function getComparisonExpression(
299 operator: TStringOperator | TNumberOperator | TBooleanOperator,
300 valueRef: string,
325
326/**
327 * Enhanced search function supporting multiple conditions with different operators
328 */
329export async function search(userId: string, {
330 filters,
331 start,
412
413
414function formatDate(date: Date) {
415 return String(getUnixTime(date) + (date.getMilliseconds() / 1000))
416}
425}
426
427function reconstructObjects(
428 results: LogRow[],
429) {

valSessionmain.tsx2 matches

@maxm•Updated 5 months ago
20`;
21
22async function newSession(valTownToken: string) {
23 const privateKeyPem = `
24-----BEGIN PRIVATE KEY-----
38}
39
40function validate(token: string) {
41 const decoded = jwt.verify(token, publicKeyPem, { algorithms: ["RS256"] }) as
42 & Awaited<

dieselmain.tsx18 matches

@maxm•Updated 5 months ago
10
11type DataFormat = 'object' | 'json' | 'yaml' | 'csv' | 'toml';
12type SelectorType = 'property' | 'index' | 'search' | 'dynamic' | 'append' | 'function';
13
14interface Selector {
40 selectors.push(this.parseAppend());
41 } else if (part.includes('(')) {
42 selectors.push(this.parseFunction(part));
43 } else {
44 // Handle top-level properties without a leading dot
112 }
113
114 private parseFunction(part: string): Selector {
115 const [funcName, argsString] = part.split('(');
116 const args = argsString.slice(0, -1).split(',').map(arg => arg.trim());
117 return { type: 'function', value: funcName, args };
118 }
119
128
129
130type FunctionHandler = (data: any, args: string[]) => any;
131
132const functions: Record<string, FunctionHandler> = {
133 length: (data) => Array.isArray(data) ? data.length : Object.keys(data).length,
134 keys: (data) => Object.keys(data),
145
146
147function applyFunction(funcName: string, data: any, args: string[] = []): any {
148 const func = functions[funcName];
149 if (!func) {
150 throw new Error(`Unknown function: ${funcName}`);
151 }
152
200
201 private async stringifyData(data: any, format: DataFormat): Promise<string> {
202 // Function to remove undefined values
203 const removeUndefined = (obj: any): any => {
204 if (Array.isArray(obj)) {
273
274
275 case 'function':
276 // If the function is 'length' and current is an array, apply it directly
277 if (selector.value === 'length' && Array.isArray(current)) {
278 return current.length;
279 }
280 // Otherwise, apply the function normally
281 current = applyFunction(selector.value as string, current, selector.args || []);
282 break;
283
336 result.push(this.traverseSelectorsForPut({}, remainingSelectors, value));
337 break;
338 case 'function':
339 throw new Error('Cannot put to a function selector');
340 }
341
383 case 'append':
384 return data;
385 case 'function':
386 throw new Error('Cannot delete from a function selector');
387 }
388

dieselREADME.md2 matches

@maxm•Updated 5 months ago
9- **Multi-format Support**: Works with JSON, YAML, CSV, and TOML.
10- **Dynamic Selectors**: Use conditions to filter data dynamically.
11- **Function Support**: Built-in functions for data manipulation (e.g., length, sum, avg).
12- **Easy Integration**: Can be used in both Deno and Val Town environments.
13
17import Diesel from "https://esm.town/v/yawnxyz/diesel";
18
19async function main() {
20 const jsonData = `
21 {

sapientLavenderHerringmain.tsx1 match

@maxm•Updated 5 months ago
1export default async function(req: Request): Promise<Response> {
2 return new Response(
3 `

valSessionREADME.md1 match

@maxm•Updated 5 months ago
25);
26
27function formatPEM(b64: string, type: "PRIVATE KEY" | "PUBLIC KEY"): string {
28 const lines = b64.match(/.{1,64}/g) || [];
29 return `-----BEGIN ${type}-----\n${lines.join("\n")}\n-----END ${type}-----`;

getFileEmail4 file matches

@shouser•Updated 6 days ago
A helper function to build a file's email

TwilioHelperFunctions

@vawogbemi•Updated 2 months ago