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.
Ttt
whackaghost
HTTP
Project : Whack-a-Ghost A responsive, browser based game where players click on randomly appearing ghosts. Features 4 difficulty levels with increasing grid sizes (4x4 to 7x7) 20-second time limit per game Score tracking with 15-point win condition Responsive design for desktop and mobile How to Play Select a difficulty level Click on ghosts as they appear Avoid empty cells (max 10 misses) Score 15 points within 20 seconds to win Show less
0

pomdtr
test_explorer
HTTP
Test Explorer Click on the play button next to list items to run them. Usage Fork this val Create new tests in any of vals (and export them) (see @pomdtr/example_test) import { assertEquals } from "https://deno.land/std@0.216.0/assert/mod.ts";
import { Test } from "https://esm.town/v/<account>/test_explorer";
export const exampleTestSuccess = new Test(() => {
assertEquals(1 + 1, 2);
});
export const exampleTestFailure = new Test(() => {
assertEquals(1 + 1, 3);
}); Go to https://<account>-test_explorer.web.val.run to run your test click on the val name to go to the val the tests are originating from click on the test name to run it ℹ️ You probably want to protect your test explorer behind an authentication middleware like @pomdtr/basicAuth Discovery mechanism In order to define a test, the user need to import the Test class from https://val.town/v/<account>/Test .
So we can use the api to search for vals containing the https://val.town/v/<account>/Test string to locate the vals containing tests. Next, we need to extract the tests from the val exports. We use exported instanceof Test to filter them (at some point we will probably use static analysis for this). TODO [x] persist test results in sqlite [x] Improve styling (help welcome ❤️) [ ] View logs in a modal [ ] Batch http requests
6
vez
comments
HTTP
Comments (just add water) A self-contained comments system Val. Just fork this val and you have a complete (but extremely minimal) comment system! Call on the front-end using: const MY_FORKED_VAL_URL = "https://vez-comments.web.val.run";
const getComments = async () => {
const response = await fetch(MY_FORKED_VAL_URL);
const json = await response.json();
return json;
};
const addComment = async (str) => {
try {
const response = await fetch(MY_FORKED_VAL_URL, {
method: "POST",
body: JSON.stringify(str),
});
if (response.status >= 400 && response.status < 600) {
/* error */
return false;
} else {
/* success */
return true;
}
} catch (e) {
/* error */
return false;
}
}; Here's an example of a blog post where I used the val for the comment system: https://vezwork.github.io/polylab/dist/demo/bidirectionalParse/. Check out "view source"!
0