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=api&page=1003&format=json

For typeahead suggestions, use the /typeahead endpoint:

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

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

Found 10997 results for "api"(1625ms)

publicDocumentEditormain.tsx1 match

@tr3ntg•Updated 1 year ago
4) {
5 let html =
6 `<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>Editor.js 🤩🧦🤨 example</title> <link href="https://fonts.googleapis.com/css?family=PT+Mono" rel="stylesheet"> <link href="../public/assets/demo.css" rel="stylesheet"> <script src="../public/assets/json-preview.js"></script> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" /></head><body> <div class="ce-example"> <div class="ce-example__header"> <a class="ce-example__header-logo" href="https://codex.so/editor">Editor.js 🤩🧦🤨</a> <div class="ce-example__header-menu"> <a href="https://github.com/editor-js" target="_blank">Plugins</a> <a href="https://editorjs.io/usage" target="_blank">Usage</a> <a href="https://editorjs.io/configuration" target="_blank">Configuration</a> <a href="https://editorjs.io/creating-a-block-tool" target="_blank">API</a> </div> </div> <div class="ce-example__content _ce-example__content--small"> <div id="editorjs"></div> <div class="ce-example__button" id="saveButton"> editor.save() </div> <div class="ce-example__statusbar"> Readonly: <b id="readonly-state"> Off </b> <div class="ce-example__statusbar-button" id="toggleReadOnlyButton"> toggle </div> </div> </div> <div class="ce-example__output"> <pre class="ce-example__output-content" id="output"></pre> <div class="ce-example__output-footer"> <a href="https://codex.so" style="font-weight: bold;">Made by CodeX</a> </div> </div> </div> <!-- Load Tools --> <!-- You can upload Tools to your project's directory and connect them by relative links. Also you can load each Tool from CDN or use NPM/Yarn packages. Read more at Tools Connection doc: https://editorjs.io/getting-started#tools-connection --> <script src="https://cdn.jsdelivr.net/npm/@editorjs/header@latest"></script><!-- Header --> <script src="https://cdn.jsdelivr.net/npm/@editorjs/simple-image@latest"></script><!-- Image --> <script src="https://cdn.jsdelivr.net/npm/@editorjs/delimiter@latest"></script><!-- Delimiter --> <script src="https://cdn.jsdelivr.net/npm/@editorjs/list@latest"></script><!-- List --> <script src="https://cdn.jsdelivr.net/npm/@editorjs/checklist@latest"></script><!-- Checklist --> <script src="https://cdn.jsdelivr.net/npm/@editorjs/quote@latest"></script><!-- Quote --> <script src="https://cdn.jsdelivr.net/npm/@editorjs/code@latest"></script><!-- Code --> <script src="https://cdn.jsdelivr.net/npm/@editorjs/embed@latest"></script><!-- Embed --> <script src="https://cdn.jsdelivr.net/npm/@editorjs/table@latest"></script><!-- Table --> <script src="https://cdn.jsdelivr.net/npm/@editorjs/link@latest"></script><!-- Link --> <script src="https://cdn.jsdelivr.net/npm/@editorjs/warning@latest"></script><!-- Warning --> <script src="https://cdn.jsdelivr.net/npm/@editorjs/marker@latest"></script><!-- Marker --> <script src="https://cdn.jsdelivr.net/npm/@editorjs/inline-code@latest"></script><!-- Inline Code --> <!-- Load Editor.js's Core --> <script src="https://cdn.jsdelivr.net/npm/@editorjs/editorjs@latest"></script><script>var editor=new EditorJS({readOnly:!1,holder:'editorjs',tools:{header:{class:Header,inlineToolbar:['marker','link'],config:{placeholder:'Header'},shortcut:'CMD+SHIFT+H'},image:SimpleImage,list:{class:List,inlineToolbar:!0,shortcut:'CMD+SHIFT+L'},checklist:{class:Checklist,inlineToolbar:!0,},quote:{class:Quote,inlineToolbar:!0,config:{quotePlaceholder:'Enter a quote',captionPlaceholder:'Quote\'s author',},shortcut:'CMD+SHIFT+O'},warning:Warning,marker:{class:Marker,shortcut:'CMD+SHIFT+M'},code:{class:CodeTool,shortcut:'CMD+SHIFT+C'},delimiter:Delimiter,inlineCode:{class:InlineCode,shortcut:'CMD+SHIFT+C'},linkTool:LinkTool,embed:Embed,table:{class:Table,inlineToolbar:!0,shortcut:'CMD+ALT+T'},},data:{},onReady:function(){saveButton.click()},onChange:function(api,event){console.log('something changed',event)}});const saveButton=document.getElementById('saveButton');const toggleReadOnlyButton=document.getElementById('toggleReadOnlyButton');const readOnlyIndicator=document.getElementById('readonly-state');saveButton.addEventListener('click',function(){editor.save().then((savedData)=>{cPreview.show(savedData,document.getElementById("output"))}).catch((error)=>{console.error('Saving error',error)})});toggleReadOnlyButton.addEventListener('click',async()=>{const readOnlyState=await editor.readOnly.toggle();readOnlyIndicator.textContent=readOnlyState?'On':'Off'})</script></body></html>`;
7 res.send(html);
8}

trpcmain.tsx1 match

@stungeye•Updated 1 year ago
3export async function trpc(userHandle, valName) {
4 return await fetch(
5 `https://www.val.town/api/trpc/getValReferenceTypes?input={%22userHandle%22:%22${userHandle}%22,%22valName%22:%22${valName}%22}`,
6 ).then((data) => data.json());
7}

aqimain.tsx1 match

@shane98c•Updated 1 year ago
4 let pm25 = (
5 await fetchJSON(
6 "https://api.openaq.org/v2/latest?" +
7 new URLSearchParams({
8 limit: "10",

myApimain.tsx1 match

@qaispalekar•Updated 1 year ago
1export function myApi(name) {
2 return "hi " + name;
3}

valEvalmain.tsx1 match

@healeycodes•Updated 1 year ago
6 const encoded = encodeURIComponent(expr.toString());
7 try {
8 const res = await fetch(`https://api.val.town/eval/${encoded}`);
9 return (await res.json()).data;
10 } catch (e) {

arbitraryFileReadmain.tsx1 match

@mattx•Updated 1 year ago
1export let arbitraryFileRead = (req, res) => {
2 // A pretty simple arbitrary file read caused by the Express API
3 // discovered and patched on January 12th
4 res.sendFile("/etc/passwd");

untitled_greenPlanarianmain.tsx1 match

@andreterron•Updated 1 year ago
1export let untitled_greenPlanarian = (() => {
2 throw new Error("API Error");
3});

postWebhookTest5main.tsx1 match

@val•Updated 1 year ago
2
3export let postWebhookTest5 = fetchJSON(
4 "https://api.val.town/express/@val.postWebhook4",
5 {
6 method: "POST",

chatmain.tsx4 matches

@chatgpt•Updated 1 year ago
5 options = {},
6) => {
7 // Initialize OpenAI API stub
8 const { Configuration, OpenAIApi } = await import("https://esm.sh/openai");
9 const configuration = new Configuration({
10 apiKey: process.env.OPENAI,
11 });
12 const openai = new OpenAIApi(configuration);
13 // Request chat completion
14 const messages = typeof prompt === "string"

vec_pracmain.tsx1 match

@valilo•Updated 1 year ago
19 a: a,
20 b: b,
21 ergebnis_link: `https://api.val.town/v1/eval/@valilo.eval_vec(${encodeURIComponent(
22 JSON.stringify(ret)
23 )})`,

daily-advice-app1 file match

@dcm31•Updated 2 days ago
Random advice app using Advice Slip API

gptApiTemplate1 file match

@charmaine•Updated 3 days ago
apiv1
papimark21