Back to APIs list

US Congress Stock Trading API examples & templates

Use these vals as a playground to view and fork US Congress Stock Trading API examples and templates on Val Town. Run any example below or find templates that can be used as a pre-built solution.
pomdtr avatar
pomdtr
verifyEmail
Script
Forked from pomdtr/verifyToken
0
caizoryan avatar
caizoryan
arena
HTTP
An interactive, runnable TypeScript val by caizoryan
0
xkonti avatar
xkonti
markdownToHtml
Script
Converts markdown string into HTML string. Usage example: import { markdownToHtml } from "https://esm.town/v/xkonti/markdownToHtml"; const markdown = ` # Hello there How are you doing *these* days? `; const html = await markdownToHtml(markdown); console.log(html)
0
wfortin avatar
wfortin
myApi
Script
An interactive, runnable TypeScript val by wfortin
0
pomdtr avatar
pomdtr
blob_editor
HTTP
Preview and edit blobs Usage: import blobEditor from "https://esm.town/v/pomdtr/blob_editor" export default blobEditor("article.md") You can easily protect your val behind @pomdtr/password_auth or @pomdtr/email_auth
0
janpaul123 avatar
janpaul123
valle_tmp_555105500793107210304339105611282
HTTP
// This val serves an HTML page with a form to enter your name.
0
yawnxyz avatar
yawnxyz
turnitdown
HTTP
HTML to Markdown Converter This is a simple web application that converts HTML to Markdown. It provides a clean and efficient way to transform HTML content into Markdown format, which is widely used for documentation and content creation. Features Easy-to-use Interface : Simple textarea inputs for HTML and Markdown output. Real-time Conversion : Converts HTML to Markdown instantly upon clicking the convert button. Clean Output : Removes scripts, styles, and other non-content elements from the HTML before conversion. Copy to Clipboard : One-click copying of the converted Markdown text. How It Works The application uses the Hono framework to create a simple web server. HTMX is used for handling AJAX requests without writing JavaScript. Alpine.js provides reactivity for the clipboard functionality. The Turndown library is used to convert HTML to Markdown. Usage Paste your HTML content into the "HTML Input" textarea. Click the "Convert to Markdown" button. The converted Markdown will appear in the "Markdown Output" textarea. Use the "Copy to Clipboard" button to easily copy the result. Technical Details The server removes <script> , <style> , and other non-content tags before conversion. HTML comments are also stripped out. The Markdown output is cleaned to remove excessive whitespace and newlines. View Source You can view the source code of this application by clicking the "View Source" link at the bottom of the page. Limitations The converter may not handle extremely complex HTML structures perfectly. Some HTML elements might not have a direct Markdown equivalent. Future Improvements Add options for customizing the Markdown output format. Implement file upload for HTML conversion. Add support for converting Markdown back to HTML. Feel free to use and modify this converter for your HTML to Markdown conversion needs!
0
webup avatar
webup
promptSampleSelectorLength
Script
An interactive, runnable TypeScript val by webup
0
juliendorra avatar
juliendorra
geolocation
Script
An interactive, runnable TypeScript val by juliendorra
0
mozzius avatar
mozzius
gif_upload
HTTP
@jsxImportSource https://esm.sh/react
0
ynonp avatar
ynonp
translateToEnglishWithOpenAI
Script
An interactive, runnable TypeScript val by ynonp
1
kora avatar
kora
gemini
Script
When use, just import { flash } from "./gemini"
0
philz avatar
philz
static
HTTP
// Sanitize title to create a URL-friendly identifier
0
pomdtr avatar
pomdtr
protected_website
HTTP
An interactive, runnable TypeScript val by pomdtr
0
tmcw avatar
tmcw
reasonPhrase
Script
The story behind HTTP 200 "OK" What's in an HTTP response? I've been writing software for the web since the early 2000s and have incrementally learned things about HTTP. There are status codes, like "200" and "404". There are headers, for Content-Type and headers to control cache settings. There are different versions of HTTP itself, like 1.1, 2, and 3. HTTP requests and responses can contain data, in the message body. But there's one thing I didn't notice until yesterday. A quirk that was included in the HTTP 1.1 specification with an authors note that it's mostly there for historical reasons: the reason-phrase . None of this information is useful. The reason-phrase is barely supported on the web and was always an oddity, but keep reading if you like oddities! If you're used to JavaScript’s fetch() method to make HTTP requests, you've seen the reason-phrase under a different name: statusText : (await fetch('https://example.com/')).statusText What is statusText ? I had assumed that it was something that JavaScript itself provides, by looking up the status code 200 and matching it with the text "OK". I was wrong! When I look at a raw HTTP response, I see the first few lines are like this: HTTP/1.1 200 OK Date: Thu, 17 Aug 2023 15:16:42 GMT Content-Type: text/plain;charset=UTF-8 The reason phrase So what is that text? I dug around in the HTTP 1.0 specification and found the section Status Code and Reason Phrase . The Status-Code element is a 3-digit integer result code of the attempt to understand and satisfy the request. The Reason-Phrase is intended to give a short textual description of the Status-Code. The Status-Code is intended for use by automata and the Reason-Phrase is intended for the human user. The client is not required to examine or display the Reason-Phrase. That also lists recommended reason phrases, like OK for 200 and Not Found for 404. And notes that you can choose different phrases without affecting the protocol. The HTTP 1.1 specification adds a little color about the reason-phrase : So, with a HTTP server, you can customize your reason phrase! Here's an example with a val on Val Town: let customReason = (req) => new Response("", { statusText: 'Hello world!', }); Unfortunately, this doesn't work! The response that Val Town produces is reorganized and optimized by Cloudflare, which upgrades requests and responses from HTTP 1.1 to HTTP 2. And sadly, HTTP 2 dropped support for the custom reason-phrase . RIP the reason-phrase . It was present even in a 1992 draft of the HTTP specification , and was a weird and under-appreciated way to pilfer extra information in a response. Now, thanks to HTTP/2 and the commonplace use of proxies and CDNs like Cloudflare, it's no longer usable. It was fun while it lasted.
1
stevekrouse avatar
stevekrouse
emptyReturn1
Script
An interactive, runnable TypeScript val by stevekrouse
0