891. Click `Fork`
102. Change `location` (Line 4) to describe your location. It accepts fairly flexible English descriptions which it turns into locations via [nominatim's geocoder API](https://www.val.town/v/stevekrouse/nominatimSearch).
113. Click `Run`
12
passwordGenmain.tsx11 matches
157const [policy, setPolicy] = useState({
158minLength: 12,
159requireCapital: true,
160requireSpecial: true,
161allowedSpecial: "!@#$%^&*()_+-=[]{}|;:,.<>?",
174...policy,
175minLength: 8,
176requireCapital: false,
177requireSpecial: false,
178});
182...policy,
183minLength: 12,
184requireCapital: true,
185requireSpecial: true,
186});
190...policy,
191minLength: 16,
192requireCapital: true,
193requireSpecial: true,
194});
292<input
293type="checkbox"
294id="requireCapital"
295checked={policy.requireCapital}
296onChange={(e) => setPolicy({ ...policy, requireCapital: e.target.checked })}
297className="w-5 h-5 text-green-600"
298/>
299<label htmlFor="requireCapital" className="text-lg">Require Capital Letter</label>
300</div>
301<div className="flex items-center space-x-2">
453<meta name="viewport" content="width=device-width, initial-scale=1.0">
454<title>Advanced Password Generation System</title>
455<link href="https://fonts.googleapis.com/css2?family=Roboto+Slab:wght@400;700&display=swap" rel="stylesheet">
456<script src="https://cdn.tailwindcss.com"></script>
457<script>
586password = password.slice(0, insertIndex) + securePhrase + password.slice(insertIndex);
587588// Ensure capital letter if required
589if (policy.requireCapital && !/[A-Z]/.test(password)) {
590const index = Math.floor(Math.random() * password.length);
591password = password.slice(0, index) + password[index].toUpperCase() + password.slice(index + 1);
fullPageWebsiteScrapermain.tsx4 matches
78console.log("Debug - Full query being sent:", query);
7980console.log(`Making LSD API request for ${websiteUrl}`);
81const response = await fetch(
82`https://lsd.so/api?query=${encodeURIComponent(query)}`,
83);
84161a`;
162163console.log(`Making LSD API request for ${pageUrl}`);
164const response = await fetch(
165`https://lsd.so/api?query=${encodeURIComponent(pageQuery)}`,
166);
167
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 {