114<title>HTML to Markdown Converter (with Table and Link Support)</title>
115<meta name="viewport" content="width=device-width, initial-scale=1">
116<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;700&display=swap" rel="stylesheet">
117<style>${css}</style>
118</head>
sqliteExplorerAppREADME.md1 match
13## Authentication
1415Login to your SQLite Explorer with [password authentication](https://www.val.town/v/pomdtr/password_auth) with your [Val Town API Token](https://www.val.town/settings/api) as the password.
1617## Todos / Plans
sqliteExplorerAppmain.tsx2 matches
27<head>
28<title>SQLite Explorer</title>
29<link rel="preconnect" href="https://fonts.googleapis.com" />
3031<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
32<link
33href="https://fonts.googleapis.com/css2?family=Fira+Code:wght@300..700&family=Source+Sans+3:ital,wght@0,200..900;1,200..900&display=swap"
34rel="stylesheet"
35/>
xmasRedHamstermain.tsx2 matches
2728async function getMostPopularPinterestImage(query: string): Promise<string> {
29const searchUrl = `https://api.pinterest.com/v5/search/pins?query=${encodeURIComponent(query)}&page_size=50&sort_order=popularity`;
30const response = await fetch(searchUrl, {
31headers: {
3637if (!response.ok) {
38throw new Error(`Pinterest API request failed: ${response.statusText}`);
39}
40
xmasRedHamstermain.tsx2 matches
2728async function getMostPopularPinterestImage(query: string): Promise<string> {
29const searchUrl = `https://api.pinterest.com/v5/search/pins?query=${encodeURIComponent(query)}&page_size=50&sort_order=popularity`;
30const response = await fetch(searchUrl, {
31headers: {
3637if (!response.ok) {
38throw new Error(`Pinterest API request failed: ${response.statusText}`);
39}
40
tokencountermain.tsx36 matches
10const [modelFamily, setModelFamily] = useState("Anthropic");
11const [tokenCount, setTokenCount] = useState(null);
12const [anthropicApiKey, setAnthropicApiKey] = useState("");
13const [geminiApiKey, setGeminiApiKey] = useState("");
14const [isLoading, setIsLoading] = useState(false);
1516useEffect(() => {
17const storedAnthropicKey = localStorage.getItem("anthropicApiKey");
18const storedGeminiKey = localStorage.getItem("geminiApiKey");
19if (storedAnthropicKey) setAnthropicApiKey(storedAnthropicKey);
20if (storedGeminiKey) setGeminiApiKey(storedGeminiKey);
21}, []);
2223const saveApiKey = (key, value) => {
24localStorage.setItem(key, value);
25};
2627const handleApiKeyChange = (e, setFunction, storageKey) => {
28const value = e.target.value;
29setFunction(value);
30saveApiKey(storageKey, value);
31};
3233const countTokens = async () => {
34if (modelFamily === "Anthropic" && anthropicApiKey) {
35try {
36const response = await fetch("/api/count-tokens", {
37method: "POST",
38headers: {
40},
41body: JSON.stringify({
42apiKey: anthropicApiKey,
43systemPrompt,
44userPrompt,
55return 0;
56}
57} else if (modelFamily === "Google Gemini" && geminiApiKey) {
58try {
59const genAI = new GoogleGenerativeAI(geminiApiKey);
60const modelOptions = {
61model: "models/gemini-1.5-pro",
83}
84} else {
85// Fallback to simple word count when API keys are not available
86return (systemPrompt + userPrompt + tools).split(/\s+/).length;
87}
95}
9697if (modelFamily === "Anthropic" && !anthropicApiKey) {
98alert("Please provide your Anthropic API key.");
99return;
100}
101102if (modelFamily === "Google Gemini" && !geminiApiKey) {
103alert("Please provide your Google Gemini API key.");
104return;
105}
111} catch (error) {
112console.error("Error:", error);
113alert("An error occurred while processing your request. Please check your API key and try again.");
114} finally {
115setIsLoading(false);
169{modelFamily === "Anthropic" && (
170<div>
171<label htmlFor="anthropicApiKey" className="block text-purple-300 mb-2">Anthropic API Key:</label>
172<input
173type="password"
174id="anthropicApiKey"
175value={anthropicApiKey}
176onChange={(e) => handleApiKeyChange(e, setAnthropicApiKey, "anthropicApiKey")}
177placeholder="Enter your Anthropic API key"
178className="w-full p-2 bg-gray-700 text-white rounded-md focus:outline-none focus:ring-2 focus:ring-purple-500"
179/>
182{modelFamily === "Google Gemini" && (
183<div>
184<label htmlFor="geminiApiKey" className="block text-purple-300 mb-2">Google Gemini API Key:</label>
185<input
186type="password"
187id="geminiApiKey"
188value={geminiApiKey}
189onChange={(e) => handleApiKeyChange(e, setGeminiApiKey, "geminiApiKey")}
190placeholder="Enter your Google Gemini API key"
191className="w-full p-2 bg-gray-700 text-white rounded-md focus:outline-none focus:ring-2 focus:ring-purple-500"
192/>
225const url = new URL(request.url);
226227if (url.pathname === "/api/count-tokens") {
228if (request.method !== "POST") {
229return new Response("Method Not Allowed", { status: 405 });
231232const { Anthropic } = await import("https://esm.sh/@anthropic-ai/sdk");
233const { apiKey, systemPrompt, userPrompt, tools } = await request.json();
234235const anthropic = new Anthropic({ apiKey });
236const countRequest = {
237betas: ["token-counting-2024-11-01"],
264}
265266if (url.pathname === "/api/generate-anthropic") {
267if (request.method !== "POST") {
268return new Response("Method Not Allowed", { status: 405 });
270271const { Anthropic } = await import("https://esm.sh/@anthropic-ai/sdk");
272const { apiKey, systemPrompt, userPrompt } = await request.json();
273274const anthropic = new Anthropic({ apiKey });
275276try {
weatherDashboardmain.tsx3 matches
3import { createRoot } from "https://esm.sh/react-dom/client";
45const API_BASE_URL = "https://api.open-meteo.com/v1/forecast";
67const weatherIcons = {
34async function fetchWeatherData(city) {
35try {
36const response = await fetch(`${API_BASE_URL}?latitude=40.71&longitude=-74.01&daily=weathercode,temperature_2m_max,temperature_2m_min,precipitation_probability_max¤t_weather=true&timezone=auto&forecast_days=7`);
37const data = await response.json();
38setWeatherData(data);
126127const css = `
128@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;700&display=swap');
129130body {
generateframeImagemain.tsx5 matches
5async function getWeather(latitude: number, longitude: number) {
6const url =
7`https://api.open-meteo.com/v1/forecast?latitude=${latitude}&longitude=${longitude}¤t_weather=true&temperature_unit=fahrenheit`;
8try {
9const response = await fetch(url);
10if (!response.ok) {
11throw new Error(`Weather API responded with status: ${response.status}`);
12}
13const data = await response.json();
143144async function generateImage(html: string): Promise<Response> {
145const apiKey = Deno.env.get("API_FLASH_KEY");
146const encodedHtml = encodeURIComponent(html);
147const url =
148`https://api.apiflash.com/v1/urltoimage?access_key=${apiKey}&url=https://michaelwschultz-generateframeimage.web.val.run&width=800&height=480&format=png&fresh=true`;
149150try {
151const response = await fetch(url);
152if (!response.ok) {
153throw new Error(`APIFlash responded with status: ${response.status}`);
154}
155return response;
1import { API_URL } from "https://esm.town/v/std/API_URL";
2import { LibsqlError, type ResultSet, type Row, type TransactionMode } from "npm:@libsql/client";
3import { z } from "npm:zod";
3536async function execute(statement: InStatement, args?: InArgs): Promise<ResultSet> {
37const res = await fetch(`${API_URL}/v1/sqlite/execute`, {
38method: "POST",
39headers: {
5051async function batch(statements: InStatement[], mode?: TransactionMode): Promise<ResultSet[]> {
52const res = await fetch(`${API_URL}/v1/sqlite/batch`, {
53method: "POST",
54headers: {
7879/* Val Town's Turso Proxy returns rows as an array of values
80* Yet the LibSQL API has a Row type which behave as an array or object,
81* ie you can access it via numerical index or string
82*/
simpleWikipediaInstantSearchmain.tsx2 matches
44<meta name="viewport" content="width=device-width, initial-scale=1.0">
45<title>Simple Wikipedia Instant Search</title>
46<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600&display=swap" rel="stylesheet">
47<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
48<style>
49body {