blob_adminmain.tsx8 matches
13}
1415function Tooltip({ children, content }: TooltipProps) {
16const [isVisible, setIsVisible] = useState(false);
17const tooltipRef = useRef<HTMLDivElement>(null);
52}
5354function formatBytes(bytes, decimals = 2) {
55if (bytes === 0) return "0 Bytes";
56const k = 1024;
61}
6263function copyToClipboard(text) {
64navigator.clipboard.writeText(text).then(() => {
65console.log("Text copied to clipboard");
69}
7071function ActionMenu({ blob, onDownload, onRename, onDelete, onMoveToPublic, onMoveOutOfPublic }) {
72const [isOpen, setIsOpen] = useState(false);
73const menuRef = useRef(null);
7677useEffect(() => {
78function handleClickOutside(event) {
79if (menuRef.current && !menuRef.current.contains(event.target)) {
80event.stopPropagation();
158}
159160function BlobItem({ blob, onSelect, isSelected, onDownload, onRename, onDelete, onMoveToPublic, onMoveOutOfPublic }) {
161const [isLoading, setIsLoading] = useState(false);
162const decodedKey = decodeURIComponent(blob.key);
219}
220221function App({ initialEmail, initialProfile }) {
222const encodeKey = (key: string) => encodeURIComponent(key);
223const decodeKey = (key: string) => decodeURIComponent(key);
645}
646647function client() {
648const initialEmail = document.getElementById("root").getAttribute("data-email");
649const initialProfile = JSON.parse(document.getElementById("root").getAttribute("data-profile"));
MathFlashCard_RetroEditionmain.tsx5 matches
4import confetti from "https://esm.sh/canvas-confetti";
56function generateProblem(config) {
7const operations = [];
8if (config.addition) operations.push('+');
54}
5556function MathFlashcards() {
57const MAX_STREAK = 5; // Number of segments in streak bar
58const SUPER_STREAK_THRESHOLD = 5; // Threshold for special animations
383}
384385function App() {
386return React.createElement("div", { className: "app" }, React.createElement(MathFlashcards, null));
387}
388389function client() {
390createRoot(document.getElementById("root")).render(React.createElement(App, null));
391}
392if (typeof document !== "undefined") { client(); }
393394export default async function server(request: Request): Promise<Response> {
395return new Response(
396`
katakanaWordApimain.tsx1 match
1import { OpenAI } from "https://esm.town/v/std/openai";
23export default async function(request: Request): Promise<Response> {
4try {
5const openai = new OpenAI();
3132// ------------
33// Functions
34// ------------
3536async function execute(statement: InStatement, args?: InArgs): Promise<ResultSet> {
37const res = await fetch(`${API_URL}/v1/sqlite/execute`, {
38method: "POST",
49}
5051async function batch(statements: InStatement[], mode?: TransactionMode): Promise<ResultSet[]> {
52const res = await fetch(`${API_URL}/v1/sqlite/batch`, {
53method: "POST",
64}
6566function createResError(body: string) {
67try {
68const e = zLibsqlError.parse(JSON.parse(body));
85}
8687function normalizeStatement(statement: InStatement, args?: InArgs) {
88if (Array.isArray(statement)) {
89// for the case of an array of arrays
107}
108109function upgradeResultSet(results: ImpoverishedResultSet): ResultSet {
110return {
111...results,
116// adapted from
117// https://github.com/tursodatabase/libsql-client-ts/blob/17dd996b840c950dd22b871adfe4ba0eb4a5ead3/packages/libsql-client/src/sqlite3.ts#L314C1-L337C2
118function rowFromSql(
119sqlRow: Array<unknown>,
120columns: Array<string>,
decisiveRoseFelidaemain.tsx5 matches
3import { createRoot } from "https://esm.sh/react-dom/client";
45function WeatherDashboard() {
6const [theme, setTheme] = useState('light');
7const [weather, setWeather] = useState(null);
1516useEffect(() => {
17async function fetchWeather() {
18try {
19const response = await fetch(
157}
158159function client() {
160createRoot(document.getElementById("root")).render(<WeatherDashboard />);
161}
163if (typeof document !== "undefined") { client(); }
164165export default async function server(request: Request): Promise<Response> {
166return new Response(`
167<html>
182}
183184function generateCSS(theme: 'light' | 'dark') {
185return `
186:root {
Snake_gamemain.tsx4 matches
8const INITIAL_FOOD = { x: 15, y: 15 };
910// Helper function to check if two directions are opposite
11const isOppositeDirection = (dir1, dir2) => {
12const oppositeMap = {
19};
2021function SnakeGame() {
22const [snake, setSnake] = useState(INITIAL_SNAKE);
23const [food, setFood] = useState(INITIAL_FOOD);
211}
212213function client() {
214createRoot(document.getElementById("root")).render(<SnakeGame />);
215}
216if (typeof document !== "undefined") { client(); }
217218export default async function server(request: Request): Promise<Response> {
219return new Response(`
220<html>
switchExtractormain.tsx2 matches
12const dataChart: { variable: string; value: number }[][] = [];
1314function getValueOf(text: string): number {
15const pattern = new RegExp(`,${text}=0x([a-zA-Z0-9]+)`, "g");
16const match = pattern.exec(str);
40}
41};
42export function solve(p: Array<any> | string) {
43if (Array.isArray(p)) {
44return p;
scraper_templateREADME.md1 match
133. Adjust the if statement to detect changes and update your blob
14154. Craft a message to be sent with `sendNotification()` function
3132// ------------
33// Functions
34// ------------
3536async function execute(statement: InStatement): Promise<ResultSet> {
37const res = await fetch(`${API_URL}/v1/sqlite/execute`, {
38method: "POST",
48}
4950async function batch(statements: InStatement[], mode?: TransactionMode): Promise<ResultSet[]> {
51const res = await fetch(`${API_URL}/v1/sqlite/batch`, {
52method: "POST",
62}
6364function createResError(body: string) {
65try {
66const e = zLibsqlError.parse(JSON.parse(body));
113*
114* The types are currently shown for types declared in a SQL table. For
115* column types of function calls, for example, an empty string is
116* returned.
117*/
336const room = db.joinRoom('editor', 'main');
337338// Add jq processing functions
339async function jqFilter(input, filter) {
340try {
341const jsonString = typeof input === 'string' ? input : JSON.stringify(input);
349350// Add jq filter input with enter key handler
351$('#jq-filter').on('keypress', async function(e) {
352if (e.which === 13) { // Enter key
353e.preventDefault();
400document.body.appendChild(cursorContainer);
401402function updateCursor(e) {
403const cursor = {
404x: e.clientX,
411}
412413function createCursorElement(peerId, cursor) {
414let el = document.getElementById('cursor-' + peerId);
415if (!el) {
428}
429430function removeCursor(peerId) {
431const el = document.getElementById('cursor-' + peerId);
432if (el) el.remove();
433}
434435$(function() {
436// Track cursor movement
437document.addEventListener('mousemove', throttle(updateCursor, 50));
484});
485486function saveJsonDoc(content, isNew = false) {
487if (!content) return;
488
520}, 500);
521522$('#json-input').bind('input', function() {
523const inputData = $(this).val();
524debouncedSave(inputData, !currentDocId);
525});
526527function updateDocsList(docs) {
528const $list = $('#docs-list');
529$list.empty();
573});
574575// Resizer functionality
576const $resizer = $("#resizer");
577const $jsonInput = $("#json-input");
588let isResizing = false;
589590$resizer.on("mousedown", function() {
591isResizing = true;
592$("body").css("cursor", "ew-resize");
593});
594595$(document).on("mousemove", function(e) {
596if (!isResizing) return;
597const totalWidth = $("body").width();
604});
605606$(document).on("mouseup", function() {
607if (isResizing) {
608isResizing = false;
644645// Add click handler for Apply jq button
646$('#apply-jq').on('click', async function() {
647const filter = $('#jq-filter').val().trim();
648const rawInput = $('#json-input').val().trim();
665});
666667// Add XML to JSON conversion function
668function parseXmlToJson(xml) {
669// If this is the document node, get the root element
670if (xml.nodeType === 9) { // DOCUMENT_NODE
721}
722723// Add these helper functions before detectInputFormat
724
725726// Modify detectInputFormat function
727function detectInputFormat(input) {
728729// Rest of your existing format detection code...
791792// Update createJsonView to show filter info
793function createJsonView(json, parent, depth = 0, meta = {}) {
794if (depth === 0) {
795if (meta.compressed) {
848parent.append(element);
849850toggle.on("click", function() {
851$(this).parent().toggleClass("collapsed");
852});
882}
883884// Add this function near other utility functions
885async function applyJqFilter(rawInput, filter) {
886if (!rawInput) {
887$("#json-view").empty();
914915// Modify updateJsonView to use the jq filter if present
916async function updateJsonView() {
917const rawInput = $("#json-input").val()?.trim() || '';
918const filter = $("#jq-filter").val()?.trim();
958959// Modify the document ready section to include jq filter changes
960$(document).ready(function() {
961const jsonInput = $("#json-input");
962const jqFilter = $("#jq-filter");
977});
978979// Utility function to throttle cursor updates
980function throttle(func, limit) {
981let inThrottle;
982return function(...args) {
983if (!inThrottle) {
984func.apply(this, args);
990991// Add debounce utility
992function debounce(func, wait) {
993let timeout;
994return function executedFunction(...args) {
995const later = () => {
996clearTimeout(timeout);