my-first-val03_cron.tsx1 match
2// Configure the timer with the 🕒 icon in the top right.
3// This example just logs the current time.
4export function scheduledHandler() {
5const timestamp = new Date().toISOString();
6console.log(`Cron val executed at: ${timestamp}`);
my-first-val02_http.tsx1 match
2// Access it via its public URL (you can also pick a nicer subdomain).
3// Try adding ?name=YourName to the URL!
4export default function httpHandler(req: Request): Response {
5const url = new URL(req.url);
6const name = url.searchParams.get("name") || "Friend";
my-first-val01_script.tsx1 match
1// This script returns a random fun fact
2// You can run scripts manually in this view or call it from other vals.
3export default function getRandomFact() {
4const funFacts = [
5"Honey never spoils.",
HHGtoMyDaygetTodoist.ts4 matches
30}
3132async function deleteExistingTodoistEvents() {
33await sqlite.execute(
34`
43* @returns Array of Todoist tasks due today or overdue
44*/
45async function fetchTodoistTasks(): Promise<TodoistTask[]> {
46const apiToken = Deno.env.get("TODOIST_API_TOKEN");
4787* @returns Memory object
88*/
89function convertTodoistTaskToMemory(task: TodoistTask): Memory {
90return {
91id: task.id.toString(),
101* Stores Todoist tasks in SQLite database
102*/
103export default async function storeTodoistTasksToMemories() {
104const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
105
HHGtoMyDaysendDailyBrief.ts6 matches
8import { formatMemoriesForPrompt, getRelevantMemories } from "../memoryUtils.ts";
910async function generateBriefingContent(anthropic, memories, today, isSunday) {
11try {
12const weekdaysHelp = generateWeekDays(today);
92}
9394export async function sendDailyBriefing(today?: DateTime) {
95// Get API keys from environment
96const apiKey = Deno.env.get("ANTHROPIC_API_KEY");
131const lastSunday = today.startOf("week").minus({ days: 1 });
132133// Fetch relevant memories using the utility function
134const memories = await getRelevantMemories();
135222}
223224function generateWeekDays(today) {
225let output = [];
226245// console.log(weekDays);
246247// Export a function that calls sendDailyBriefing with no parameters
248// This maintains backward compatibility with existing cron jobs
249export default async function(overrideToday?: DateTime) {
250return await sendDailyBriefing(undefined, overrideToday);
251}
telegramBotStartertestBot.tsx2 matches
5import { sendTelegramMessage } from "https://esm.town/v/asdfg/telegramBotStarter/sendTelegramMessage.tsx";
67async function testBot() {
8const ownerChatId = process.env.OWNER_CHAT_ID;
926}
2728// console log testBot function
29// console.log(await testBot);
30
untitled-1471new-file-8788.tsx20 matches
150// --- AUDIO CONTEXT for UI Sounds ---
151let audioCtx;
152function initAudio() {
153if (!audioCtx) {
154audioCtx = new (window.AudioContext || window.webkitAudioContext)();
155}
156}
157function playSound(type = 'click') {
158if (!audioCtx) return;
159const oscillator = audioCtx.createOscillator();
272});
273
274// --- Game Logic Functions ---
275function loadGameState() {
276try {
277const savedData = localStorage.getItem(CONFIG.SAVE_KEY);
288}
289}
290function saveGameState() {
291try {
292localStorage.setItem(CONFIG.SAVE_KEY, JSON.stringify(gameState));
295}
296}
297function applyShake() {
298if (shakeDuration > 0) {
299const dx = (Math.random() - 0.5) * shakeIntensity * 2;
307}
308}
309function triggerShake(intensity, duration) {
310shakeIntensity = Math.max(shakeIntensity, intensity);
311shakeDuration = Math.max(shakeDuration, duration);
312}
313function getDistance(x1, y1, x2, y2) {
314const dx = x2 - x1; const dy = y2 - y1; return Math.sqrt(dx * dx + dy * dy);
315}
316function createFloatingText(text, x, y, color = 'white', size = 16) {
317floatingTexts.push({ text, x, y, color, size, opacity: 1, yOffset: 0, creationTime: Date.now() });
318}
596}
597598// --- Game Flow & UI Functions ---
599function startNewWave() {
600currentWave++;
601ui.wave.textContent = currentWave;
611}
612}
613function spawnMenForWave(count, isBossWave = false) {
614const numToSpawn = Math.min(count, menToSpawnThisWave - menSpawnedThisWave);
615const currentPercentRanged = Math.min(CONFIG.MAX_PERCENT_RANGED, CONFIG.PERCENT_RANGED_MEN_BASE + (currentWave - 1) * CONFIG.PERCENT_RANGED_INCREMENT_PER_WAVE);
632}
633}
634function initGame() {
635resizeCanvas();
636loadGameState();
653canvas.focus();
654}
655function updateUI() {
656displayedScore += (currentScore - displayedScore) * TWEEN_FACTOR;
657displayedBananas += (gameState.totalBananas - displayedBananas) * TWEEN_FACTOR;
675}
676
677function gameLoop(timestamp) {
678if (!gameRunning) { animationFrameId = null; return; }
679if (gamePaused) { animationFrameId = requestAnimationFrame(gameLoop); return; }
715animationFrameId = requestAnimationFrame(gameLoop);
716}
717function endGame(gorillaWins) {
718gameRunning = false; gamePaused = false;
719cancelAnimationFrame(animationFrameId); animationFrameId = null;
734735// --- Shop Logic ---
736function getUpgradeCost(level) {
737return Math.floor(CONFIG.UPGRADE_BASE_COST * Math.pow(CONFIG.UPGRADE_COST_INCREASE_FACTOR, level));
738}
739function updateShopUI() {
740ui.shopBananasDisplay.textContent = gameState.totalBananas;
741ui.hpUpgradeLevel.textContent = gameState.upgrades.maxHpLvl;
750ui.atkUpgradeCost.textContent = getUpgradeCost(gameState.upgrades.attackPowerLvl);
751}
752function purchaseUpgrade(type) {
753playSound('click');
754let levelKey = type + 'Lvl';
807clearTimeout(window.resizeTimeout); window.resizeTimeout = setTimeout(resizeCanvas, 100);
808});
809function resizeCanvas() {
810const container = document.querySelector('.game-container');
811if (!container) return;
glastonewsindex.ts1 match
2import { BskyAgent } from "npm:@atproto/api";
34async function main() {
5try {
6const agent = new BskyAgent({
ga4-eventga4-util.tsx1 match
1// ga4-util.tsx
2export async function trackGA4Event(req, clientPrefix) {
3const GA4_MEASUREMENT_ID = Deno.env.get(`${clientPrefix}_GA4_MEASUREMENT_ID`);
4const GA4_API_SECRET = Deno.env.get(`${clientPrefix}_GA4_API_KEY`);