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);
telegramWebhookEchoMessagemain.tsx17 matches
47};
4849async function handleMessage(message) {
50const userMessage = message.text;
51const chatId = message.chat.id;
62}
6364async function processUserInputWithAI(userMessage: string, tasks: Task[], state: UserState): Promise<{ response: string, updatedTasks: Task[], updatedState: UserState, suggestedActions: string[] }> {
65const taskListString = JSON.stringify(tasks);
66const stateString = JSON.stringify(state);
78Based on the user's message and the conversation context, determine the appropriate action to take and execute it.
79Be proactive in guiding the user through their tasks, focusing on prioritization and breaking down tasks into microsteps.
80You can use the following functions:
81- addTask(tasks: Task[], title: string): Adds a new task
82- markTaskAsDone(tasks: Task[], taskId: string): Marks a task as done
138}
139140function addTask(tasks: Task[], title: string) {
141const newTask: Task = {
142id: Date.now().toString(),
150}
151152function markTaskAsDone(tasks: Task[], taskId: string) {
153const task = findTask(tasks, taskId);
154if (task) {
157}
158159function breakDownTask(tasks: Task[], taskId: string, subtasks: string[]) {
160const task = findTask(tasks, taskId);
161if (task) {
175}
176177function findTask(tasks: Task[], taskId: string): Task | null {
178return tasks.find(task => task.id === taskId) || null;
179}
180181function compareTaskPriorities(tasks: Task[], taskId1: string, taskId2: string) {
182const task1 = findTask(tasks, taskId1);
183const task2 = findTask(tasks, taskId2);
191}
192193function suggestMicrosteps(taskTitle: string): string[] {
194// This function would ideally use AI to generate suggestions, but for simplicity, we'll return static suggestions
195return ["Get materials", "Prepare workspace", "Start first step"];
196}
197198function navigateTaskHierarchy(tasks: Task[], currentTaskId: string | null, direction: 'up' | 'down' | 'next' | 'prev'): string | null {
199if (!currentTaskId) return null;
200const currentTask = findTask(tasks, currentTaskId);
217}
218219function generateTaskList(tasks: Task[], showCompleted: boolean, parentId: string | null = null, indent = ''): string {
220let list = '';
221const currentLevelTasks = tasks.filter(task => task.parent_id === parentId && (showCompleted || !task.done));
231}
232233async function sendResponse(chatId: number, message: string, suggestedActions: string[]) {
234const keyboard = [
235...suggestedActions.map(action => [{ text: action }]),
254}
255256async function getTasks(chatId: number): Promise<Task[]> {
257const key = `tasks_${chatId}`;
258try {
265}
266267async function updateTasks(chatId: number, tasks: Task[]) {
268const key = `tasks_${chatId}`;
269try {
274}
275276async function getUserState(chatId: number): Promise<UserState> {
277const key = `state_${chatId}`;
278try {
285}
286287async function updateUserState(chatId: number, state: UserState) {
288const key = `state_${chatId}`;
289try {
9const agent = new AtpAgent({ service });
1011function App() {
12const [messages, setMessages] = useState([]);
13const [isActive, setIsActive] = useState(true);
213}
214215function client() {
216createRoot(document.getElementById("root")).render(<App />);
217}
221}
222223export default async function server(request: Request): Promise<Response> {
224return new Response(
225`
blob_adminmain.tsx9 matches
12}
1314function Tooltip({ children, content }: TooltipProps) {
15const [isVisible, setIsVisible] = useState(false);
16const tooltipRef = useRef<HTMLDivElement>(null);
51}
5253function formatBytes(bytes, decimals = 2) {
54if (bytes === 0) return "0 Bytes";
55const k = 1024;
60}
6162function copyToClipboard(text) {
63navigator.clipboard.writeText(text).then(() => {
64console.log("Text copied to clipboard");
68}
6970function ActionMenu({ blob, onDownload, onRename, onDelete, onMoveToPublic, onMoveOutOfPublic }) {
71const [isOpen, setIsOpen] = useState(false);
72const menuRef = useRef(null);
7576useEffect(() => {
77function handleClickOutside(event) {
78if (menuRef.current && !menuRef.current.contains(event.target)) {
79event.stopPropagation();
157}
158159function BlobItem({ blob, onSelect, isSelected, onDownload, onRename, onDelete, onMoveToPublic, onMoveOutOfPublic }) {
160const [isLoading, setIsLoading] = useState(false);
161const decodedKey = decodeURIComponent(blob.key);
218}
219220function App({ initialEmail, initialProfile }) {
221const encodeKey = (key: string) => encodeURIComponent(key);
222const decodeKey = (key: string) => decodeURIComponent(key);
644}
645646function client() {
647const initialEmail = document.getElementById("root").getAttribute("data-email");
648const initialProfile = JSON.parse(document.getElementById("root").getAttribute("data-profile"));
654if (typeof document !== "undefined") { client(); }
655656export default lastlogin(async function handler(request: Request): Promise<Response> {
657if (request.method === "GET" && request.url.includes("/api/public/")) {
658const url = new URL(request.url);
chatgptchessmain.tsx4 matches
42let game = new Chess(position)
4344function onDragStart(source, piece, position, orientation) {
45// do not pick up pieces if the game is over
46if (game.isGameOver()) return false
55}
5657function onDrop(source: string, target: string) {
58// see if the move is legal
59try {
86// update the board position after the piece snap
87// for castling, en passant, pawn promotion
88function onSnapEnd() {
89board.position(game.fen())
90}
9192function updateStatus() {
93var status = ""
94
20};
2122async function uuidGen() {
23const randomBytes = CryptoJS.lib.WordArray.random(16);
24let hex = randomBytes.toString(CryptoJS.enc.Hex);
27return hex;
28}
29export async function boundGen() {
30const randomBytes = CryptoJS.lib.WordArray.random(16);
31const hex = randomBytes.toString(CryptoJS.enc.Hex);
33return boundary;
34}
35async function formDataGen(files: File[]) {
36const boundary = await boundGen();
37let body = "";
57};
58}
59async function upload(formData: any, user: string) {
60const _ = await fetch("https://workers.cloudflare.com/playground/api/worker", {
61"headers": {