Skip to content

Instantly share code, notes, and snippets.

@webshared
webshared / 3d-maze.ts
Last active December 28, 2022 14:38
ChatGPT created 3d maze shortest route search
import { Queue } from './queue'; // Queue data structure for breadth-first search
// Coordinate class to represent a point in the maze
class Coord {
constructor(public x: number, public y: number, public z: number) {}
}
// Helper function to check if a coordinate is within the bounds of the maze
function isValidCoord(maze: number[][][], coord: Coord): boolean {
return (
@webshared
webshared / Pdf.jsx
Last active September 30, 2022 09:32
React-Pdf workaround: renders PDF as Blob in browser and display at page + show download link
import React from 'react';
import {
Page, Text, Image, View, Document, StyleSheet,
createElement, pdf, PDFRenderer,
} from '@react-pdf/core';
import blobStream from 'blob-stream';
const Doc = () => (
<Document>
<Page wrap={true}>