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=image&page=274&format=json

For typeahead suggestions, use the /typeahead endpoint:

https://codesearch.val.run/typeahead?q=image

Returns an array of strings in format "username" or "username/projectName"

Found 2776 results for "image"(330ms)

imgGenUrlmain.tsx4 matches

@maxm•Updated 11 months ago
1import { generateImage } from "https://esm.town/v/isidentical/falImageGen?v=11";
2import { blob } from "https://esm.town/v/std/blob?v=12";
3
4const genKey = (key: string): string => {
5 return "genImageCache-v1-" + key;
6};
7
10 let url = await blob.getJSON(genKey(key));
11 if (!url) {
12 let resp = await generateImage(`generate the image you would expect if the url path was: "${key}"`);
13 url = resp.url;
14 await blob.setJSON(genKey(key), url);
15 }
16 return new Response((await fetch(url)).body, { headers: { "content-type": "image/jpg" } });
17}

imgGenUrlREADME.md1 match

@maxm•Updated 11 months ago
1# Image generated from a path name powered by fal.ai
2
3https://maxm-imggenurl.web.val.run/firefly.jpg

animatedReadmeSVGmain.tsx1 match

@maxm•Updated 11 months ago
89 {
90 headers: {
91 "Content-Type": "image/svg+xml",
92 },
93 },

animatedReadmeSVGREADME.md1 match

@maxm•Updated 11 months ago
1Fancy animated SVGs in readmes, along with centering and image sizing.
2```
3<div align="center"><img width=200 src="https://gpanders.com/img/DEC_VT100_terminal.jpg"></div>

vtOpenAPImain.tsx1 match

@stevekrouse•Updated 12 months ago
1// set at Thu May 02 2024 18:00:24 GMT+0000 (Coordinated Universal Time)
2export let vtOpenAPI = "openapi: 3.1.0\ninfo:\n title: Val Town API\n description: |\n The Val Town API provides services to evaluate JavaScript and TypeScript expressions, run vals as APIs, either as functions or Express handlers.\n\n Learn more at [https://docs.val.town](https://docs.val.town)\n version: 1.7.0\nservers:\n - url: https://api.val.town\n description: Val Town API v1\n\ncomponents:\n securitySchemes:\n bearerAuth:\n type: http\n scheme: bearer\n bearerFormat: API Key\n schemas:\n JSON:\n oneOf:\n - type: string\n - type: number\n - type: object\n - type: array\n items: {}\n - type: boolean\n description: \"Can be anything: string, number, array, object, etc., including `null`\"\n Relationship:\n type: string\n enum: [\"received\", \"given\", \"any\"]\n Privacy:\n type: string\n enum: [\"public\", \"unlisted\", \"private\"]\n Author:\n type: object\n properties:\n id:\n description: The user's id\n type: string\n format: uuid\n username:\n description: The user's username\n type: string\n User:\n type: object\n allOf:\n - $ref: \"#/components/schemas/Author\"\n properties:\n bio:\n description: The user's bio\n type:\n - string\n - \"null\"\n profileImageUrl:\n description: The url for the user's profile picture\n type:\n - string\n - \"null\"\n BaseVal:\n type: object\n properties:\n id:\n type: string\n format: uuid\n author:\n $ref: \"#/components/schemas/Author\"\n name:\n type: string\n code:\n type: string\n public:\n type: boolean\n deprecated: true\n privacy:\n $ref: \"#/components/schemas/Privacy\"\n version:\n type: integer\n format: int32\n runEndAt:\n type:\n - string\n - \"null\"\n format: date-time\n deprecated: true\n runStartAt:\n type:\n - string\n - \"null\"\n format: date-time\n deprecated: true\n FullVal:\n type: object\n allOf:\n - $ref: \"#/components/schemas/BaseVal\"\n properties:\n logs:\n type: array\n items: {}\n output:\n type: object\n exported:\n type: object\n error:\n type: object\n readme:\n type: string\n likeCount:\n type: number\n referenceCount:\n type: number\n ValFields:\n type: object\n properties:\n name:\n type: string\n privacy:\n $ref: \"#/components/schemas/Privacy\"\n readme:\n type:\n - string\n - \"null\"\n ValInput:\n type: object\n allOf:\n - $ref: \"#/components/schemas/ValFields\"\n properties:\n code:\n type: string\n PaginatedList:\n type: object\n properties:\n data:\n type: array\n links:\n type: object\n properties:\n self:\n description: The URL of the current page of results\n type: string\n format: uri\n next:\n description: The URL of the next page of results\n type: string\n format: uri\n prev:\n description: The URL of the previous page of results\n type: string\n format: uri\n ValList:\n type: object\n allOf:\n - $ref: \"#/components/schemas/PaginatedList\"\n properties:\n data:\n type: array\n items:\n $ref: \"#/components/schemas/BaseVal\"\n BaseValRef:\n type: object\n properties:\n id:\n description: The id of the val\n type: string\n name:\n description: The name of the val\n type: string\n author:\n $ref: \"#/components/schemas/Author\"\n author_id:\n description: The id of the val's author\n type: string\n deprecated: true\n username:\n description: The username of the val's author\n type: string\n deprecated: true\n ValRef:\n type: object\n allOf:\n - $ref: \"#/components/schemas/BaseValRef\"\n properties:\n public:\n type: boolean\n deprecated: true\n privacy:\n $ref: \"#/components/schemas/Privacy\"\n version:\n type: integer\n format: int32\n BaseRun:\n type: object\n properties:\n id:\n type: string\n format: uuid\n error: {}\n parentId:\n type: string\n format: uuid\n runEndAt:\n type:\n - string\n - \"null\"\n format: date-time\n deprecated: true\n runStartAt:\n type:\n - string\n - \"null\"\n format: date-time\n deprecated: true\n val:\n $ref: \"#/components/schemas/ValRef\"\n FullRun:\n type: object\n allOf:\n - $ref: \"#/components/schemas/BaseRun\"\n properties:\n emails:\n type: array\n items: {}\n logs:\n type: array\n items: {}\n returnValue: {}\n args:\n type: array\n items: {}\n RunList:\n type: object\n allOf:\n - $ref: \"#/components/schemas/PaginatedList\"\n properties:\n data:\n type: array\n items:\n $ref: \"#/components/schemas/BaseRun\"\n Comment:\n type: object\n properties:\n id:\n type: string\n format: uuid\n author:\n $ref: \"#/components/schemas/Author\"\n comment:\n description: The contents of the comment\n type: string\n createdAt:\n type: string\n format: date-time\n val:\n $ref: \"#/components/schemas/ValRef\"\n Reference:\n type: object\n properties:\n referencedAt:\n type: string\n format: date-time\n reference:\n $ref: \"#/components/schemas/BaseValRef\"\n dependsOn:\n $ref: \"#/components/schemas/BaseValRef\"\n CommentList:\n type: object\n allOf:\n - $ref: \"#/components/schemas/PaginatedList\"\n properties:\n data:\n type: array\n items:\n $ref: \"#/components/schemas/Comment\"\n ReferenceList:\n type: object\n allOf:\n - $ref: \"#/components/schemas/PaginatedList\"\n properties:\n data:\n type: array\n items:\n $ref: \"#/components/schemas/Reference\"\n parameters:\n expression:\n in: path\n name: expression\n required: true\n description: |\n The JavaScript or TypeScript expression to be evaluated.\n This should be a single expression, like a single function\n call, assignment operation, or calculation. If you need\n to execute multiple expressions, wrap them in a function.\n schema:\n type: string\n examples:\n simpleAddition:\n value: \"1+1\"\n summary: Simple addition\n functionCall:\n value: \"@stevekrouse.addOne(@stevekrouse.example1)\"\n summary: Calling a user's val function\n user_id:\n name: user_id\n in: path\n required: true\n description: id of the user\n schema:\n type: string\n format: uuid\n examples:\n stevekrouse:\n value: \"a0bf3b31-15a5-4d5c-880e-4b1e22c9bc18\"\n username:\n name: username\n in: path\n required: true\n description: |\n The username of the val owner, *not* including the `@` symbol.\n schema:\n type: string\n examples:\n stevekrouse:\n value: stevekrouse\n summary: Steve Krouse's username\n val_id:\n name: val_id\n in: path\n required: true\n description: id of the val\n schema:\n type: string\n format: uuid\n examples:\n hello:\n value: \"eb4a2ace-b6c8-4393-85e0-4813b3f04e12\"\n val_name:\n name: val_name\n in: path\n required: true\n description: The name of the val.\n schema:\n type: string\n examples:\n id:\n value: id\n summary: \"id\"\n description: |\n This val is a function that returns its arguments. It is useful for testing how the API handles the arguments passed to it.\n\n View the val at [https://val.town/v/stevekrouse.id](https://val.town/v/stevekrouse.id)\n version:\n name: version\n in: path\n required: true\n description: val version\n schema:\n type: number\n run_id:\n name: run_id\n in: path\n required: true\n description: id of the log\n schema:\n type: string\n format: uuid\n examples:\n hello:\n value: \"cd0653ac-aede-4d0d-8c8e-21c7ef763eb2\"\n offset:\n name: offset\n in: query\n description: Pagination offset\n schema:\n type: integer\n default: 0\n minimum: 0\n limit:\n name: limit\n in: query\n description: Pagination limit\n schema:\n type: integer\n default: 20\n minimum: 1\n maximum: 100\n comments_since:\n name: since\n in: query\n description: Return comments where `createdAt > since` (non-inclusive)\n schema:\n type: string\n examples:\n isostring:\n $ref: \"#/components/examples/isostring\"\n comments_until:\n name: until\n in: query\n description: Return comments where `createdAt <= until` (inclusive)\n schema:\n type: string\n examples:\n isostring:\n $ref: \"#/components/examples/isostring\"\n references_since:\n name: since\n in: query\n description: Return references where `referencedAt > since` (non-inclusive)\n schema:\n type: string\n examples:\n isostring:\n $ref: \"#/components/examples/isostring\"\n references_until:\n name: until\n in: query\n description: Return references where `referencedAt <= until` (inclusive)\n schema:\n type: string\n examples:\n isostring:\n $ref: \"#/components/examples/isostring\"\n relationship:\n name: relationship\n in: query\n schema:\n $ref: \"#/components/schemas/Relationship\"\n examples:\n user_stevekrouse:\n value:\n {\n \"id\": \"a0bf3b31-15a5-4d5c-880e-4b1e22c9bc18\",\n \"username\": \"@stevekrouse\",\n \"bio\": \"mayor of val town\\nhttps://stevekrouse.com\",\n \"profileImageUrl\": \"https://images.clerk.dev/uploaded/img_2PqHa2Gsy93xQrjh2w78Xu0cChW.jpeg\",\n }\n val_hello:\n value:\n {\n \"id\": \"eb4a2ace-b6c8-4393-85e0-4813b3f04e12\",\n \"author\":\n {\n \"id\": \"a0bf3b31-15a5-4d5c-880e-4b1e22c9bc18\",\n \"username\": \"@stevekrouse\",\n },\n \"name\": \"hello\",\n \"code\": 'export let hello = \"Hello World\";',\n \"public\": false,\n \"privacy\": \"private\",\n \"version\": 0,\n \"runStartAt\": null,\n \"runEndAt\": null,\n \"logs\": [],\n \"output\": { \"json\": \"Hello World\" },\n \"exported\": { \"json\": { \"hello\": \"Hello World\" } },\n \"error\": null,\n \"readme\": \"# Hello\",\n \"likeCount\": 0,\n \"referenceCount\": 0,\n }\n val_hello_v1:\n value:\n {\n \"id\": \"eb4a2ace-b6c8-4393-85e0-4813b3f04e12\",\n \"author\":\n {\n \"id\": \"a0bf3b31-15a5-4d5c-880e-4b1e22c9bc18\",\n \"username\": \"@stevekrouse\",\n },\n \"name\": \"hello\",\n \"code\": 'export let hello = \"Hello World 2\";',\n \"public\": false,\n \"privacy\": \"private\",\n \"version\": 1,\n \"runStartAt\": null,\n \"runEndAt\": null,\n \"logs\": [],\n \"output\": { \"json\": \"Hello World 2\" },\n \"exported\": { \"json\": { \"hello\": \"Hello World 2\" } },\n \"error\": null,\n \"readme\": \"# Hello\",\n \"likeCount\": 0,\n \"referenceCount\": 0,\n }\n isostring:\n value: \"2023-07-26T03:28:00.000Z\"\n summary: ISO String\n responses:\n ExpressionResult:\n description: The returned result of executing the passed expression successfully. The result can be of any JSON type. It will not include any logs that were generated during execution.\n content:\n application/json:\n schema:\n oneOf:\n - type: string\n - type: number\n - type: object\n - type: array\n items: {}\n - type: boolean\n examples:\n simpleAddition:\n value: 2\n summary: Simple addition result\n functionCall:\n value: 42\n summary: Calling a function result\n\nsecurity:\n - bearerAuth: []\n - {}\n\npaths:\n /v1/me:\n get:\n summary: Get profile information for the current user\n tags: [Me]\n responses:\n \"200\":\n description: OK\n content:\n application/json:\n schema:\n $ref: \"#/components/schemas/User\"\n examples:\n stevekrouse:\n $ref: \"#/components/examples/user_stevekrouse\"\n \"401\":\n description: Unauthorized\n\n /v1/me/likes:\n get:\n summary: Get vals liked by the current user\n tags: [Me]\n parameters:\n - $ref: \"#/components/parameters/offset\"\n - $ref: \"#/components/parameters/limit\"\n responses:\n \"200\":\n description: OK\n content:\n application/json:\n schema:\n $ref: \"#/components/schemas/ValList\"\n \"401\":\n description: Unauthorized\n\n /v1/me/comments:\n get:\n summary: Get comments related to current user, either given or received\n tags: [Me]\n parameters:\n - $ref: \"#/components/parameters/offset\"\n - $ref: \"#/components/parameters/limit\"\n - $ref: \"#/components/parameters/comments_since\"\n - $ref: \"#/components/parameters/comments_until\"\n - $ref: \"#/components/parameters/relationship\"\n responses:\n \"200\":\n description: OK\n content:\n application/json:\n schema:\n $ref: \"#/components/schemas/CommentList\"\n \"401\":\n description: Unauthorized\n\n /v1/me/references:\n get:\n summary: Returns vals that depend on any of the user's vals\n tags: [Me]\n parameters:\n - $ref: \"#/components/parameters/offset\"\n - $ref: \"#/components/parameters/limit\"\n - $ref: \"#/components/parameters/references_since\"\n - $ref: \"#/components/parameters/references_until\"\n responses:\n \"200\":\n description: OK\n content:\n application/json:\n schema:\n $ref: \"#/components/schemas/ReferenceList\"\n \"401\":\n description: Unauthorized\n\n /v1/vals:\n post:\n summary: Create a new val\n tags: [Vals]\n requestBody:\n description: Code of the new val to be run.\n required: true\n content:\n application/json:\n schema:\n $ref: \"#/components/schemas/ValInput\"\n examples:\n increment:\n value: { \"code\": 'let hello = \"Hello World\";' }\n text/plain:\n schema:\n type: string\n examples:\n increment:\n value: 'let hello = \"Hello World\";'\n text/javascript:\n schema:\n type: string\n examples:\n increment:\n value: 'let hello = \"Hello World\";'\n application/javascript:\n schema:\n type: string\n examples:\n increment:\n value: 'let hello = \"Hello World\";'\n responses:\n \"200\":\n description: OK\n content:\n application/json:\n schema:\n $ref: \"#/components/schemas/FullVal\"\n examples:\n hello:\n $ref: \"#/components/examples/val_hello\"\n \"401\":\n description: Unauthorized\n put:\n summary: Create or update a val by name and code.\n tags: [Vals]\n requestBody:\n description: The JSON to set the val to\n required: true\n content:\n application/json:\n schema:\n type: object\n properties:\n name:\n type: string\n description: Name of the val\n code:\n type: string\n description: Code to run for the val\n required:\n - name\n - code\n responses:\n \"200\":\n description: OK\n content:\n application/json:\n schema:\n $ref: \"#/components/schemas/BaseVal\"\n \"401\":\n description: Unauthorized\n \"400\":\n description: Error\n\n /v1/vals/{val_id}:\n get:\n summary: Get val by id\n tags: [Vals]\n parameters:\n - $ref: \"#/components/parameters/val_id\"\n responses:\n \"200\":\n description: OK\n content:\n application/json:\n schema:\n $ref: \"#/components/schemas/FullVal\"\n examples:\n hello:\n $ref: \"#/components/examples/val_hello\"\n \"404\":\n description: Val not found\n put:\n summary: Update a val's name or privacy\n tags: [Vals]\n parameters:\n - $ref: \"#/components/parameters/val_id\"\n requestBody:\n description: Fields to be updated.\n required: true\n content:\n application/json:\n schema:\n $ref: \"#/components/schemas/ValFields\"\n examples:\n name_and_privacy:\n value: { \"name\": \"hello\", \"privacy\": \"unlisted\" }\n responses:\n \"204\":\n description: No Content\n \"401\":\n description: Unauthorized\n delete:\n summary: Delete a val\n tags: [Vals]\n parameters:\n - $ref: \"#/components/parameters/val_id\"\n responses:\n \"204\":\n description: No Content\n\n /v1/vals/{val_id}/versions:\n get:\n summary: List versions of a val\n tags: [Vals]\n parameters:\n - $ref: \"#/components/parameters/val_id\"\n - $ref: \"#/components/parameters/offset\"\n - $ref: \"#/components/parameters/limit\"\n responses:\n \"200\":\n description: OK\n content:\n application/json:\n schema:\n type: object\n allOf:\n - $ref: \"#/components/schemas/PaginatedList\"\n properties:\n data:\n type: array\n items:\n type: object\n properties:\n val_id:\n type: string\n format: uuid\n description: Unique identifier for the val.\n version:\n type: number\n description: Version number of the val.\n runStartAt:\n type:\n - string\n - \"null\"\n format: date-time\n deprecated: true\n runEndAt:\n type:\n - string\n - \"null\"\n format: date-time\n deprecated: true\n \"404\":\n description: Val not found\n post:\n summary: Create a new version of a val\n tags: [Vals]\n parameters:\n - $ref: \"#/components/parameters/val_id\"\n requestBody:\n description: Code of the new version to be run.\n required: true\n content:\n application/json:\n schema:\n $ref: \"#/components/schemas/ValInput\"\n examples:\n increment:\n value: { \"code\": 'let hello = \"Hello World 2\";' }\n text/plain:\n schema:\n type: string\n examples:\n increment:\n value: 'let hello = \"Hello World 2\";'\n text/javascript:\n schema:\n type: string\n examples:\n increment:\n value: 'let hello = \"Hello World 2\";'\n application/javascript:\n schema:\n type: string\n examples:\n increment:\n value: 'let hello = \"Hello World 2\";'\n responses:\n \"201\":\n description: Created\n content:\n application/json:\n schema:\n $ref: \"#/components/schemas/FullVal\"\n examples:\n hello:\n $ref: \"#/components/examples/val_hello_v1\"\n \"404\":\n description: Val not found\n\n /v1/vals/{val_id}/versions/{version}:\n get:\n summary: Get a specific version of a val\n tags: [Vals]\n parameters:\n - $ref: \"#/components/parameters/val_id\"\n - $ref: \"#/components/parameters/version\"\n responses:\n \"200\":\n description: OK\n content:\n application/json:\n schema:\n $ref: \"#/components/schemas/FullVal\"\n examples:\n hello:\n $ref: \"#/components/examples/val_hello\"\n \"404\":\n description: Val or version not found\n delete:\n summary: Delete a val version\n tags: [Vals]\n parameters:\n - $ref: \"#/components/parameters/val_id\"\n - $ref: \"#/components/parameters/version\"\n responses:\n \"204\":\n description: No Content\n\n /v1/users/{user_id}/vals:\n get:\n summary: List a user's vals\n tags: [Users]\n parameters:\n - $ref: \"#/components/parameters/user_id\"\n - $ref: \"#/components/parameters/offset\"\n - $ref: \"#/components/parameters/limit\"\n responses:\n \"200\":\n description: OK\n content:\n application/json:\n schema:\n $ref: \"#/components/schemas/ValList\"\n\n /v1/alias/{username}:\n get:\n summary: Get a user profile information by their username\n tags: [Alias]\n parameters:\n - $ref: \"#/components/parameters/username\"\n responses:\n \"200\":\n description: OK\n content:\n application/json:\n schema:\n $ref: \"#/components/schemas/User\"\n examples:\n stevekrouse:\n $ref: \"#/components/examples/user_stevekrouse\"\n \"404\":\n description: Not found\n\n /v1/alias/{username}/{val_name}:\n get:\n summary: Get a val by the author's username and val name\n tags: [Alias]\n parameters:\n - $ref: \"#/components/parameters/username\"\n - $ref: \"#/components/parameters/val_name\"\n responses:\n \"200\":\n description: OK\n content:\n application/json:\n schema:\n $ref: \"#/components/schemas/FullVal\"\n \"404\":\n description: Not found\n\n /v1/search/vals:\n get:\n summary: Search for vals across the platform\n tags: [Search]\n parameters:\n - name: query\n in: query\n description: Search query\n required: true\n schema:\n type: string\n minLength: 1\n maxLength: 512\n - $ref: \"#/components/parameters/offset\"\n - $ref: \"#/components/parameters/limit\"\n responses:\n \"200\":\n description: OK\n content:\n application/json:\n schema:\n $ref: \"#/components/schemas/ValList\"\n\n /v1/eval/{expression}:\n get:\n summary: Evaluate a JavaScript or TypeScript expression\n tags: [\"Eval\"]\n description: |\n Evaluates the JavaScript or TypeScript `{expression}` and responds with the returned result. \n\n ### Unauthenticated\n Unauthenticated use will have read-only access to public vals. \n\n ### Authenticated\n Authenticated use will have read access to the authenticated user's private vals and secrets, write access to the authenticated user's vals, and the ability to send the authenticated user emails via `console.email`.\n\n Vals generated via this API will *not* appear in the authenticated user's workspace.\n parameters:\n - $ref: \"#/components/parameters/expression\"\n responses:\n \"200\":\n $ref: \"#/components/responses/ExpressionResult\"\n \"400\":\n description: Bad request or Error thrown executing user code\n \"404\":\n description: Not found\n \"500\":\n description: Internal server error\n\n /v1/eval:\n post:\n summary: Evaluate a JavaScript or TypeScript expression\n tags: [\"Eval\"]\n description: |\n Evaluates the JavaScript or TypeScript `{expression}` and responds with the returned result. \n\n ### Unauthenticated\n Unauthenticated use will have read-only access to public vals. \n\n ### Authenticated\n Authenticated use will have read access to the authenticated user's private vals and secrets, write access to the authenticated user's vals, and the ability to send the authenticated user emails via `console.email`.\n\n Vals generated via this API will *not* appear in the authenticated user's workspace.\n requestBody:\n description: When used as a POST endpoint, the request body\n must contain the code to be run.\n required: true\n content:\n application/json:\n schema:\n type: object\n required: [\"code\"]\n properties:\n code:\n type: string\n args:\n type: array\n items:\n $ref: \"#/components/schemas/JSON\"\n examples:\n \"Add two numbers\":\n value: { \"code\": \"(a, b) => a + b\", \"args\": [1, 42] }\n responses:\n \"200\":\n $ref: \"#/components/responses/ExpressionResult\"\n \"400\":\n description: Bad request or Error thrown executing user code\n \"404\":\n description: Not found\n \"500\":\n description: Internal server error\n\n /v1/run/{username}.{val_name}:\n get:\n deprecated: true\n summary: Run a val as an API\n tags: [\"Run\"]\n description: This endpoint runs the specified user's val and returns the output.\n parameters:\n - $ref: \"#/components/parameters/username\"\n - $ref: \"#/components/parameters/val_name\"\n - in: query\n name: args\n schema:\n type: string\n description: The args query parameter can provide arguments to the given val. The parameter needs to be a JSON-encoded array, in which each item in the array is passed to the val as a function parameter.\n examples:\n name:\n value: '[\"Steve\"]'\n summary: Calling a function with a single string argument\n empty:\n value: \"\"\n responses:\n \"200\":\n $ref: \"#/components/responses/ExpressionResult\"\n \"400\":\n description: Bad request or Error thrown executing user code\n \"404\":\n description: Not found\n \"500\":\n description: Internal server error\n post:\n deprecated: true\n summary: Run a val as an API\n tags: [\"Run\"]\n parameters:\n - $ref: \"#/components/parameters/username\"\n - $ref: \"#/components/parameters/val_name\"\n requestBody:\n required: false\n description: Provide arguments to the given val function by including a post body with your request.\n content:\n application/json:\n schema:\n type: object\n additionalProperties: false\n properties:\n args:\n type: array\n items:\n $ref: \"#/components/schemas/JSON\"\n responses:\n \"200\":\n $ref: \"#/components/responses/ExpressionResult\"\n \"400\":\n description: Bad request or Error thrown executing user code\n \"404\":\n description: Not found\n \"500\":\n description: Internal server error\n\n \"/\":\n servers:\n - url: https://{username}-{val_name}.express.val.run\n description: Val Town API v1\n variables:\n username:\n default: stevekrouse\n val:\n default: expressHTMLExample\n get:\n summary: Run a val as an API (as an Express handler)\n tags: [\"Express\"]\n description: |\n Runs `@{username}.{val_name}` as an Express handler. \n\n `@{username}.{val_name}` must be a function. It is passed the Express [`req`](https://expressjs.com/en/4x/api.html#req) and [`res`](https://expressjs.com/en/4x/api.html#res) objects as its arguments. You can use `req` to pull out request data, and `res` to respond with any valid Express response. Learn more at the [Express docs](https://expressjs.com/en/4x/api.html).\n\n Unlike the other two APIs, the Express API is specified via subdomain and runs at `https://{username}-{val_name}.express.val.run`.\n\n ### Unauthenticated\n Unauthenticated use will only be able to call public vals as Express handlers.\n\n The val will be executed with `{username}`'s permissions (\"API Mode\"), so it will be able to read and write to `{username}`'s public and private vals, secrets, and use `console.email`.\n\n ### Authenticated\n Authenticated use is able to call private vals as Express handlers.\n responses:\n \"200\":\n description: Function executed successfully\n content:\n \"*/*\":\n schema:\n type: string\n description: The result of the executed function, in any media type\n \"400\":\n description: Bad request or Error thrown executing user code\n \"404\":\n description: Not found\n \"500\":\n description: Internal server error\n post:\n summary: Run a val as an API (as an Express handler)\n tags: [\"Express\"]\n description: |\n Runs `@{username}.{val_name}` as an Express handler. \n\n `@{username}.{val_name}` must be a function. It is passed the Express [`req`](https://expressjs.com/en/4x/api.html#req) and [`res`](https://expressjs.com/en/4x/api.html#res) objects as its arguments. You can use `req` to pull out request data, and `res` to respond with any valid Express response. Learn more at the [Express docs](https://expressjs.com/en/4x/api.html).\n\n ### Unauthenticated\n Unauthenticated use will only be able to call public vals as Express handlers.\n\n The val will be executed with `{username}`'s permissions (\"API Mode\"), so it will be able to read and write to `{username}`'s public and private vals, secrets, and use `console.email`.\n\n ### Authenticated\n Authenticated use is able to call private vals as Express handlers.\n requestBody:\n description: |\n The request body will be accessible to the val Express handler under the first argument, commonly called `req`, as `req.body`.\n required: false\n content:\n application/json:\n schema:\n $ref: \"#/components/schemas/JSON\"\n examples:\n name:\n value: '{\"name\": \"Steve\"}'\n summary: JSON object as the request body\n responses:\n \"200\":\n description: Function executed successfully\n content:\n \"*/*\":\n schema:\n type: string\n description: The result of the executed function, in any media type\n \"400\":\n description: Bad request or Error thrown executing user code\n \"404\":\n description: Not found\n \"500\":\n description: Internal server error\n";

modifyImageREADME.md3 matches

@stevekrouse•Updated 1 year ago
1Code from https://deno.com/blog/build-image-resizing-api
2
3Useful for compressing an image before sending to chatgpt4v, for example
4
5Migrated from folder: Archive/modifyImage

discordClerkWebhookHandlerExamplemain.tsx1 match

@maxm•Updated 1 year ago
12 content: body.data.email_addresses[0].email_address
13 + " "
14 + body.data.profile_image_url,
15 });
16 return new Response("Success");

dailyStandupBotREADME.md1 match

@stevekrouse•Updated 1 year ago
3Every weekday at 9am EDT send a message to our team's #engineering Discord channel to start a thread to remind us to do our standup.
4
5![Screenshot 2024-03-14 at 09.27.26.png](https://imagedelivery.net/iHX6Ovru0O7AjmyT5yZRoA/c5309028-4983-4a27-1aab-0e2bb0fc1800/public)
6
7Slack version: @mikker/dailySlackRoundup

retroVisitCountermain.tsx4 matches

@maxm•Updated 1 year ago
173 }
174 }
175 // Move around the bytes and encode the image
176 const flatImageData = [].concat(...numberData);
177 for (let i = 0; i < width * height * 4; i++) {
178 pngData[i] = flatImageData[i];
179 }
180 const png = encode(pngData, width, height);
182 return new Response(png, {
183 headers: {
184 "Content-Type": "image/png",
185 "Cache-Control": "no-cache, no-store, must-revalidate",
186 "Pragma": "no-cache",

companyREADME.md1 match

@stevekrouse•Updated 1 year ago
3This val forwards emails to addresses that don't exist to all of us at Val Town. For example, this forwards `feedback@val.town` to all of us. We achieve this by forwarding emails to this email handler, and this email handler forwards them along.
4
5![Screenshot 2024-02-16 at 10.03.59.png](https://imagedelivery.net/iHX6Ovru0O7AjmyT5yZRoA/ed84d865-20b1-49b1-946d-4d836c902600/public)
6
7To accomplish this without Val Town would require setting up a Google Group. I prefer doing it in code. Over time we will have more complex routing here.

brainrot_image_gen1 file match

@dcm31•Updated 2 days ago
Generate images for Italian Brainrot characters using FAL AI

modifyImage2 file matches

@stevekrouse•Updated 2 days ago