playgroundwordpress.ts8 matches
8283// Fetch posts with optional parameters
84export async function getPosts(params: {
85page?: number;
86per_page?: number;
112113// Fetch a single post by slug
114export async function getPostBySlug(slug: string): Promise<Post> {
115const posts = await getPosts({ slug, embed: true });
116
123124// Fetch pages with optional parameters
125export async function getPages(params: {
126page?: number;
127per_page?: number;
149150// Fetch a single page by slug
151export async function getPageBySlug(slug: string): Promise<Page> {
152const pages = await getPages({ slug, embed: true });
153
160161// Fetch categories
162export async function getCategories(): Promise<Category[]> {
163const url = `${API_URL}/categories?per_page=100`;
164const response = await fetch(url);
172173// Fetch tags
174export async function getTags(): Promise<Tag[]> {
175const url = `${API_URL}/tags?per_page=100`;
176const response = await fetch(url);
184185// Fetch media
186export async function getMedia(id: number): Promise<Media> {
187const url = `${API_URL}/media/${id}`;
188const response = await fetch(url);
196197// Fetch site info
198export async function getSiteInfo() {
199const url = 'https://mehr-research.science/wp-json';
200const response = await fetch(url);
playgroundREADME.md1 match
8- `/src/components/` - Reusable UI components
9- `/src/layouts/` - Page layouts
10- `/src/lib/` - Utility functions and API clients
11- `/public/` - Static assets
12
demo-ai-mamain.js10 matches
11const PORT = 3001;
12
13async function pdfToImages(pdfPath) {
14return new Promise((resolve, reject) => {
15const py = spawn('python', ['pdf_to_images.py', pdfPath]);
33}
34
35async function sendToClaude(images) {
36const prompt = `
37You are an expert at reading real estate contract documents. Extract the following information and return it as a JSON object with these sections and fields:
129
130// Helper to clean $ from non-monetary fields
131function cleanValue(v, key) {
132if (typeof v === 'string' && v.startsWith('$')) {
133// Only keep $ for exact monetary field names
147
148// Helper to render a section as a Bootstrap card
149function renderSection(title, fields) {
150if (title === 'Payment Plan') {
151// Parse the installment data
238
239// Helper to render Parties Information
240function renderPartyTable(party, data) {
241return `
242<table class="table table-bordered mb-4">
337
338<script>
339function toggleJson() {
340const content = document.getElementById('jsonContent');
341content.style.display = content.style.display === 'none' ? 'block' : 'none';
380const canvas = document.getElementById('pdf-preview');
381const ctx = canvas.getContext('2d');
382fileInput.addEventListener('change', function(e) {
383const file = e.target.files[0];
384if (file && file.type === 'application/pdf') {
385const fileReader = new FileReader();
386fileReader.onload = function() {
387const typedarray = new Uint8Array(this.result);
388pdfjsLib.getDocument(typedarray).promise.then(function(pdf) {
389pdf.getPage(1).then(function(page) {
390const viewport = page.getViewport({ scale: 0.9 });
391canvas.width = viewport.width;
umbrellaRemindermain.tsx1 match
1export async function testReminder() {
2fetch('https://jsonplaceholder.typicode.com/todos/1')
3.then(response => response.json())
TownieValTownLogo.tsx1 match
1/** @jsxImportSource https://esm.sh/react@18.2.0?dev */
23export function ValTownLogo () {
4return (
5<svg
TownieuseUser.tsx1 match
3const USER_ENDPOINT = "/api/user";
45export function useUser() {
6const [data, setData] = useState<any>(null);
7const [loading, setLoading] = useState(true);
TownieuseUsageStats.ts1 match
1import { useEffect } from "react";
23export function useUsageStats(messages: any[], usages: any[]) {
4useEffect(() => {
5if (!messages?.length) return;
TownieuseScrollToBottom.tsx3 matches
7*
8* @param {Array} dependencies - Array of dependencies that trigger scrolling when changed
9* @returns {Object} An object containing containerRef and scrollToBottom function
10*/
11export function useScrollToBottomContainer(dependencies = []) {
12const containerRef = useRef(null);
132829// body scroll version
30export function useScrollToBottom(dependencies = []) {
31const bottomRef = useRef(null);
32
Townieuser-summary.ts1 match
6* This includes a fallback to inference calls data when usage data is missing
7*/
8export async function getUserSummary() {
9// First, get the standard grouped data from the usage table
10const groupedUsageData = await sqlite.execute(`
TownieuseProject.tsx1 match
4const FILES_ENDPOINT = "/api/project-files";
56export function useProject(projectId: string, branchId?: string) {
7const [data, setData] = useState<any>(null);
8const [loading, setLoading] = useState(true);