trAIderAgentgetStockAnalysis.ts2 matches
7980export async function getStockAnalysis(ticker: string) {
81console.log("Fetching Yahoo Finance data for:", ticker);
8283try {
89}
9091return { error: `Unknow error while fetching ${ticker}` };
92}
93}
farcasterFlingsmain.tsx1 match
1export const farcasterFlings = async () => {
2let FARCASTER_USERNAME = "whatrocks";
3let flings = await fetch(
4`https://searchcaster.xyz/api/search?regex=%E2%8C%86&username=${FARCASTER_USERNAME}`,
5).then((res) => res.json());
GitHubSyncREADME.md4 matches
1213- `/push` will copy the contents from a list of vals specified in `config.json` and push them to a GitHub repo
14- `/deploy` is a GitHub webhook URL that will fetch contents from GitHub and update the code on Val Town
15161. Fork this val
271. Add a `VAL_SECRET` env var to the val. Use this secret to sign the webhook POST request to the `/push` endpoint. Use this endpoint to commit vals from Val Town to your GitHub repo.
2829### Example push to GitHub fetch
3031You can use this example to POST to the `/push` endpoint to copy vals to GitHub.
46const signature = await sign(body, secret);
4748const res = await fetch(url, {
49method: "POST",
50body,
89- [x] Monkey test
90- [x] Add setup instructions to readme
91- [x] Add example code for private webhook fetch
92- [x] Make val and repo public
93- [ ] Check modified date before export to GitHub??
GitHubSyncindex1 match
22app.post("/deploy", verifyGitHubSignature(GITHUB_WEBHOOK_SECRET), deploy);
2324export default app.fetch;
reactHonoExample_toowiredApp.tsx2 matches
1819try {
20const response = await fetch("/api/research", {
21method: "POST",
22headers: { "Content-Type": "application/json" },
31}]);
32} catch (error) {
33console.error("Error fetching data:", error);
34setMessages(prev => [...prev, {
35text: "Sorry, I encountered an error while researching. Please try again.",
OpenTownieBranchControl.tsx22 matches
30const [showCreateBranch, setShowCreateBranch] = useState<boolean>(false);
3132// Fetch branches when project changes
33useEffect(() => {
34if (!projectId) return;
3536const fetchBranches = async () => {
37setIsLoadingBranches(true);
38try {
39const response = await fetch(`/api/project-branches?projectId=${projectId}`, {
40headers: {
41"Authorization": `Bearer ${bearerToken}`,
4445if (!response.ok) {
46throw new Error(`Failed to fetch branches: ${response.statusText}`);
47}
4849const data = await response.json();
50const fetchedBranches = data.branches || [];
51setBranches(fetchedBranches);
5253// Check if the stored branchId is valid for this project
54const storedBranchIsValid = fetchedBranches.some((branch: Branch) => branch.id === branchId);
5556// Only set a new branchId if there isn't a valid one already stored
57if (!storedBranchIsValid && fetchedBranches.length > 0) {
58// If branches are loaded and there's a "main" branch, select it by default
59const mainBranch = fetchedBranches.find((branch: Branch) => branch.name === "main");
60if (mainBranch) {
61setBranchId(mainBranch.id);
63} else {
64// Otherwise select the first branch
65setBranchId(fetchedBranches[0].id);
66setSelectedBranchName(fetchedBranches[0].name);
67}
68} else if (storedBranchIsValid) {
69// Set the selected branch name based on the stored branchId
70const selectedBranch = fetchedBranches.find((branch: Branch) => branch.id === branchId);
71if (selectedBranch) {
72setSelectedBranchName(selectedBranch.name);
74}
75} catch (error) {
76console.error("Error fetching branches:", error);
77} finally {
78setIsLoadingBranches(false);
80};
8182fetchBranches();
83}, [projectId, bearerToken, branchId, setBranchId]);
84105// Refresh the branches list
106if (projectId) {
107const fetchBranches = async () => {
108try {
109const response = await fetch(`/api/project-branches?projectId=${projectId}`, {
110headers: {
111"Authorization": `Bearer ${bearerToken}`,
114115if (!response.ok) {
116throw new Error(`Failed to fetch branches: ${response.statusText}`);
117}
118119const data = await response.json();
120const fetchedBranches = data.branches || [];
121setBranches(fetchedBranches);
122123// Update the selected branch name
124const selectedBranch = fetchedBranches.find((branch: Branch) => branch.id === newBranchId);
125if (selectedBranch) {
126setSelectedBranchName(selectedBranch.name);
127}
128} catch (error) {
129console.error("Error fetching branches:", error);
130}
131};
132133fetchBranches();
134}
135};
ATProtoOAuthStartermain.tsx1 match
139app.get("/callback", (c) => c.json(c.req));
140app.get("/client-metadata.json", (c) => c.json(clientMetadata));
141export default app.fetch;
spagindex.html6 matches
231uploadButton.disabled = true;
232uploadButton.textContent = "Uploading...";
233const response = await fetch("/api/upload", {
234method: "POST",
235body,
251);
252253async function fetchUploads() {
254const response = await fetch("/api/list");
255const data = await response.json();
256return data.rows;
261previewAllButton.hidden = true;
262refreshButton.textContent = "Refreshing...";
263const uploads = await fetchUploads();
264renderUploads(uploads);
265refreshButton.textContent = "Refresh";
311previewContainer.innerHTML = "";
312try {
313fetch(`https://spag.cc/${upload.name}`).then(async (response) => {
314if (!response.ok) {
315const textElement = document.createElement("p");
395deleteButton.disabled = true;
396deleteButton.textContent = "Deleting...";
397const response = await fetch(
398`/api/delete`,
399{
spagindex.html6 matches
231uploadButton.disabled = true;
232uploadButton.textContent = "Uploading...";
233const response = await fetch("/api/upload", {
234method: "POST",
235body,
251);
252253async function fetchUploads() {
254const response = await fetch("/api/list");
255const data = await response.json();
256return data.rows;
261previewAllButton.hidden = true;
262refreshButton.textContent = "Refreshing...";
263const uploads = await fetchUploads();
264renderUploads(uploads);
265refreshButton.textContent = "Refresh";
311previewContainer.innerHTML = "";
312try {
313fetch(`https://spag.cc/${upload.name}`).then(async (response) => {
314if (!response.ok) {
315const textElement = document.createElement("p");
395deleteButton.disabled = true;
396deleteButton.textContent = "Deleting...";
397const response = await fetch(
398`/api/delete`,
399{
OpenTownieCreateBranch.tsx1 match
43
44try {
45const response = await fetch("/api/create-branch", {
46method: "POST",
47headers: {