what_did_i_work_on_todaymain.tsx14 matches
10const DEMO_MODE = true;
1112// Time window for fetching activity
13const HOURS_TO_FETCH = 30;
1415// GitHub Settings
90<h2>{type}</h2>
91{items.length === 0
92? <p>No {type.toLowerCase()} found in the last {HOURS_TO_FETCH} hours</p>
93: (
94<ul className="list">
119useEffect(() => {
120Promise.all([
121fetch("/api/prs").then(async (res) => {
122if (!res.ok) {
123const error = await res.json();
124throw new Error(error.message || "Failed to fetch PRs");
125}
126return res.json();
127}),
128fetch("/api/issues").then(async (res) => {
129if (!res.ok) {
130const error = await res.json();
131throw new Error(error.message || "Failed to fetch issues");
132}
133return res.json();
197}
198199const timeAgo = new Date(Date.now() - (HOURS_TO_FETCH * MILLISECONDS_PER_HOUR)).toISOString();
200201const response = await fetch(
202`https://api.github.com/search/issues?q=repo:${GITHUB.REPOSITORY}+author:${GITHUB.USERNAME}+created:>${timeAgo}+type:pr`,
203{
205"Accept": "application/vnd.github.v3+json",
206"Authorization": `Bearer ${githubToken}`,
207"User-Agent": "Val-Town-PR-Fetcher",
208},
209},
212if (!response.ok) {
213const error = await response.json();
214return createErrorResponse(error.message || "Failed to fetch from GitHub", response.status);
215}
216231}
232233const timeAgo = new Date(Date.now() - (HOURS_TO_FETCH * MILLISECONDS_PER_HOUR)).toISOString();
234235const query = `
252`;
253254const response = await fetch("https://api.linear.app/graphql", {
255method: "POST",
256headers: {
263if (!response.ok) {
264const error = await response.json();
265return createErrorResponse(error.message || "Failed to fetch from Linear", response.status);
266}
267
passwordgamemain.tsx1 match
54setLoading(true);
55try {
56const response = await fetch("/", {
57method: "POST",
58body: JSON.stringify({ level, password, requirements }),
passwordgamemain.tsx1 match
54setLoading(true);
55try {
56const response = await fetch("/", {
57method: "POST",
58body: JSON.stringify({ level, password, requirements }),
skilledCoffeePanthermain.tsx2 matches
95
96// Test API connection
97fetch(API_URL + "/")
98.then(response => {
99if (!response.ok) throw new Error();
138
139try {
140const response = await fetch(API_URL + "/message", {
141method: "POST",
142headers: {
findSlamArticlesmain.tsx1 match
24
25try {
26const response = await fetch(targetUrl);
27const html = await response.text();
28const $ = cheerio.load(html);
slackReplyToMessagemain.tsx4 matches
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
23export const slackReplyToMessage = async (req: Request) => {
16// Reply to app_mention events
17if (body.event.type === "app_mention") {
18const usersResponse = await fetchJSON(
19`https://slack.com/api/usergroups.users.list?usergroup=S07S1056LN6`,
20{
28// Ensure the response was successful and contains users
29if (!usersResponse.ok || !usersResponse.users || usersResponse.users.length === 0) {
30console.error("Failed to fetch users or no users found");
31return new Response(undefined, { status: 500 });
32}
3738// Send a message mentioning the randomly selected user
39const result = await fetchJSON(
40"https://slack.com/api/chat.postMessage",
41{
40}
4142const response = await fetch("/create", {
43method: "POST",
44headers: { "Content-Type": "application/json" },
138139// Record the win
140await fetch("/record-win", {
141method: "POST",
142headers: { "Content-Type": "application/json" },
232233useEffect(() => {
234fetchGames();
235}, []);
236237const fetchGames = async () => {
238const response = await fetch("/admin/games");
239const data = await response.json();
240setGames(data);
243const deleteGame = async (id: string) => {
244if (!confirm(`Delete game "${games.find(g => g.id === id)?.name}"?`)) return;
245await fetch(`/admin/games/${id}`, { method: "DELETE" });
246fetchGames();
247};
248249const deleteAllGames = async () => {
250if (!confirm("Delete ALL games? This cannot be undone!")) return;
251await fetch("/admin/games", { method: "DELETE" });
252fetchGames();
253};
254
blob_adminmain.tsx2 matches
1/** @jsxImportSource https://esm.sh/hono@4.0.8/jsx **/
23import { modifyFetchHandler } from "https://esm.town/v/andreterron/codeOnValTown?v=50";
4import view_route from "https://esm.town/v/pomdtr/blob_admin_blob";
5import create_route from "https://esm.town/v/pomdtr/blob_admin_create";
137});
138139export default modifyFetchHandler(passwordAuth(app.fetch));
15<label for="dateSelect">Select Date: </label>
16<input type="date" id="dateSelect">
17<button id="fetchButton" class="fetch-button">Fetch Data</button>
18</div>
19<div class="table-container">
50// Set up date picker with yesterday as default
51const dateSelect = document.getElementById('dateSelect');
52const fetchButton = document.getElementById('fetchButton');
53const loadingElement = document.getElementById('loading');
54
65dateSelect.max = formatDate(yesterday); // Prevent future dates
6667async function fetchData() {
68try {
69loadingElement.classList.remove('hidden');
70fetchButton.disabled = true;
71
72const selectedDate = dateSelect.value;
73const url = \`https://kalshi-public-docs.s3.amazonaws.com/reporting/market_data_\${selectedDate}.json\`;
74const response = await fetch(url);
75if (!response.ok) {
76throw new Error('Data not available for selected date');
81renderTable();
82} catch (error) {
83console.error('Error fetching data:', error);
84document.getElementById('tableBody').innerHTML =
85'<tr><td colspan="10" style="text-align: center;">No data available for selected date</td></tr>';
86} finally {
87loadingElement.classList.add('hidden');
88fetchButton.disabled = false;
89}
90}
150});
151152// Add fetch button click handler
153fetchButton.addEventListener('click', fetchData);
154155// Initial fetch
156fetchData();
157</script>
158</body>
187}
188189.fetch-button {
190padding: 8px 16px;
191background-color: #007bff;
197}
198199.fetch-button:hover {
200background-color: #0056b3;
201}
202203.fetch-button:disabled {
204background-color: #ccc;
205cursor: not-allowed;
42let currentSort = { key: 'daily_volume', direction: 'desc' };
4344async function fetchData() {
45try {
46const response = await fetch('https://kalshi-public-docs.s3.amazonaws.com/reporting/market_data_2024-10-22.json');
47const data = await response.json();
48tableData = Array.isArray(data) ? data : [data]; // Handle single object or array
50renderTable();
51} catch (error) {
52console.error('Error fetching data:', error);
53}
54}
115});
116117// Initial fetch
118fetchData();
119</script>
120</body>