bluesky-thinkup-tributewatcher.tsx2 matches
1import { email } from "https://esm.town/v/std/email?v=13";
2import { sqlite } from "https://esm.town/v/std/sqlite2?v=1";
3import { AtpAgent, AtpSessionData, AtpSessionEvent } from "npm:@atproto/api";
4import diff from "npm:fast-diff@1.3.0";
52627// Supports up to 5,000 (100*50) follows, stopping there to try
28// and avoid rate limits. These APIs have pretty low limits, sound off here
29// https://github.com/bluesky-social/atproto/discussions/3356
30outerLoop: for (let i = 0; i < 20; i++) {
bluesky-thinkup-tributeREADME.md2 matches
18I was an avid user of [ThinkUp](https://www.thinkupapp.com/), a tool that connected to Twitter and sent me a daily email with profile updates from all the people I followed. I found it useful in work and for fun. Maybe one of my friends switched jobs or changed their username to something goofy or political. I want to know! In the distant past Facebook would include profile updates in the newsfeed: why not that for Twitter? ThinkUp did some other cool stuff, like providing full archives of Tweets in a more convenient format than Twitter did themselves.
1920But Twitter [is bad now](https://macwright.com/2025/03/04/twitter-eol) and ThinkUp [shut down in 2016](https://www.thinkupapp.com/) because [the APIs that they were relying on from Twitter, Facebook, and Instagram were all locked down and limited](https://medium.com/@anildash/the-end-of-thinkup-e600bc46cc56). How disappointing.
2122But there's a new social network in town, [Bluesky](https://bsky.app/), and it's ~~impossible~~ somewhat more difficult to corrupt and enshittify than those networks were, and it comes with a pretty good, if sometimes weird API that gives you access to everything you need.
2324Could you build some of ThinkUp on Bluesky? Yes. This is it.
aatest-openai.ts9 matches
23/**
4* Simple test to verify OpenAI API key is working
5*/
6export default async function(): Promise<Response> {
7try {
8// Check for OpenAI API key
9const apiKey = Deno.env.get("OPENAI_API_KEY");
10if (!apiKey) {
11return new Response(JSON.stringify({
12error: "OpenAI API key is missing",
13message: "Please set the OPENAI_API_KEY environment variable in Val Town."
14}), {
15status: 500,
18}
1920// Test OpenAI API
21const openai = new OpenAI();
22const completion = await openai.chat.completions.create({
30return new Response(JSON.stringify({
31success: true,
32message: "OpenAI API key is working correctly",
33response: completion.choices[0].message.content
34}), {
37} catch (error) {
38return new Response(JSON.stringify({
39error: "OpenAI API test failed",
40message: error.message || "Unknown error"
41}), {
1314- `/course-generator.ts` - Core logic for generating course structures using OpenAI
15- `/frontend-handler.ts` - HTTP handler that serves the frontend and processes API requests
16- `/frontend/index.html` - Web interface for the course generator
17254. View the generated course structure with modules and lessons
2627### API Usage
2829You can also use the course generator as an API:
3031```javascript
32// Example API call
33const response = await fetch('YOUR_VAL_TOWN_URL', {
34method: 'POST',
44## Response Format
4546The API returns a JSON object with the following structure:
4748```json
73## Requirements
7475- OpenAI API key set as an environment variable in Val Town
7677## Setup Instructions
78791. In Val Town, go to your account settings
802. Add an environment variable named `OPENAI_API_KEY` with your OpenAI API key
813. Deploy both the course-generator.ts and frontend-handler.ts files with HTTP triggers
8285If the application isn't generating any responses, check the following:
86871. **OpenAI API Key**: Make sure you've set the `OPENAI_API_KEY` environment variable in Val Town
882. **Console Logs**: Check the Val Town logs for any error messages
893. **Browser Console**: Open your browser's developer tools to check for any JavaScript errors
904. **API Limits**: If you're using a free OpenAI API key, you might have hit your usage limits
aacourse-generator.ts5 matches
27*/
28export async function generateCourseStructure(prompt: string): Promise<CourseStructure> {
29// Check for OpenAI API key
30const apiKey = Deno.env.get("OPENAI_API_KEY");
31if (!apiKey) {
32console.error("OpenAI API key is missing. Please set the OPENAI_API_KEY environment variable in Val Town.");
33throw new Error("OpenAI API key is missing. Please set the OPENAI_API_KEY environment variable in Val Town.");
34}
35
satori-syntax-highlighterREADME.md2 matches
16│ ├── index.ts # Main entry point with Hono setup
17│ └── routes/
18│ └── highlighter-route.ts # Highlighter API route
19├── frontend/
20│ ├── components/
37## Usage
3839Visit the frontend page to customize and generate syntax-highlighted images. The API endpoint is available at `/api/highlighter` with the following parameters:
4041- `code`: The code to highlight
satori-syntax-highlighterindex.tsx2 matches
12});
1314// API routes
15app.get("/api/highlighter", highlighterHandler);
1617// Serve static files
Towniesystem_prompt.txt10 matches
13- Generate code in TypeScript or TSX
14- Add appropriate TypeScript types and interfaces for all data structures
15- Prefer official SDKs or libraries than writing API calls directly
16- Ask the user to supply API or library documentation if you are at all unsure about it
17- **Never bake in secrets into the code** - always use environment variables
18- Include comments explaining complex logic (avoid commenting obvious operations)
23### 1. HTTP Trigger
2425- Create web APIs and endpoints
26- Handle HTTP requests and responses
27- Example structure:
167However, it's *extremely importing* to note that `parseProject` and other Standard Library utilities ONLY RUN ON THE SERVER.
168If you need access to this data on the client, run it in the server and pass it to the client by splicing it into the HTML page
169or by making an API request for it.
170171## Val Town Platform Specifics
175- **AI Image:** To inline generate an AI image use: `<img src="https://maxm-imggenurl.web.val.run/the-description-of-your-image" />`
176- **Storage:** DO NOT use the Deno KV module for storage
177- **Browser APIs:** DO NOT use the `alert()`, `prompt()`, or `confirm()` methods
178- **Weather Data:** Use open-meteo for weather data (doesn't require API keys) unless otherwise specified
179- **View Source:** Add a view source link by importing & using `import.meta.url.replace("ems.sh", "val.town)"` (or passing this data to the client) and include `target="_top"` attribute
180- **Error Debugging:** Add `<script src="https://esm.town/v/std/catch"></script>` to HTML to capture client-side errors
181- **Error Handling:** Only use try...catch when there's a clear local resolution; Avoid catches that merely log or return 500s. Let errors bubble up with full context
182- **Environment Variables:** Use `Deno.env.get('keyname')` when you need to, but generally prefer APIs that don't require keys
183- **Imports:** Use `https://esm.sh` for npm and Deno dependencies to ensure compatibility on server and browser
184- **Storage Strategy:** Only use backend storage if explicitly required; prefer simple static client-side sites
218### Backend (Hono) Best Practices
219220- Hono is the recommended API framework
221- Main entry point should be `backend/index.ts`
222- Do NOT use Hono serveStatic middleware
243});
244```
245- Create RESTful API routes for CRUD operations
246- Always include this snippet at the top-level Hono app to re-throwing errors to see full stack traces:
247```ts
280- For files in the project, use `readFile` helpers
2812825. **API Design:**
283- `fetch` handler is the entry point for HTTP vals
284- Run the Hono app with `export default app.fetch // This is the entry point for HTTP vals`
16): string {
17return (
18`${baseUrl}/api/highlighter?code=` +
19encodeURIComponent(code) +
20'&background=' +
JobChatApptypes.ts2 matches
19}
2021// API response interfaces
22export interface ApiResponse<T> {
23success: boolean;
24data?: T;