This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| import time | |
| import os | |
| import random | |
| class GameOfLife: | |
| def __init__(self, width=50, height=20, random_seed=True): | |
| """ | |
| Initialize the Game of Life grid | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { useState, useEffect } from "react"; | |
| const GameOfLife: React.FC = () => { | |
| const [grid, setGrid] = useState<number[][]>([]); | |
| const [isRunning, setIsRunning] = useState(false); | |
| const initializeGrid = () => { | |
| const rows = 25; | |
| const cols = 25; | |
| const newGrid = Array.from({ length: rows }, () => |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { useState } from 'react'; | |
| const LandingPage: React.FC = () => { | |
| const [email, setEmail] = useState(''); | |
| const handleSubmit = (e: React.FormEvent) => { | |
| e.preventDefault(); | |
| alert(`Email submitted: ${email}`); | |
| setEmail(''); | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { useState } from 'react'; | |
| const LandingPage: React.FC = () => { | |
| const [email, setEmail] = useState(''); | |
| const [message, setMessage] = useState(''); | |
| const handleSubmit = (e: React.FormEvent) => { | |
| e.preventDefault(); | |
| alert(`Email: ${email}, Message: ${message}`); | |
| setEmail(''); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from 'react'; | |
| const ButterflySVG: React.FC = () => { | |
| return ( | |
| <svg | |
| xmlns="http://www.w3.org/2000/svg" | |
| viewBox="0 0 200 120" | |
| className="w-full max-w-md mx-auto" | |
| > | |
| {/* Body */} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from 'react'; | |
| const Butterfly: React.FC = () => ( | |
| <div className="flex justify-center items-center p-4"> | |
| <svg | |
| className="w-32 h-32 text-indigo-500" | |
| viewBox="0 0 64 64" | |
| fill="currentColor" | |
| xmlns="http://www.w3.org/2000/svg" | |
| > |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { useState } from "react"; | |
| const isLeapYear = (year: number): boolean => { | |
| return (year % 4 === 0 && year % 100 !== 0) || (year % 400 === 0); | |
| }; | |
| const getNextLeapYears = (count: number): number[] => { | |
| const leapYears: number[] = []; | |
| let currentYear = new Date().getFullYear(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { useState } from 'react'; | |
| const LeapYearCalculator: React.FC = () => { | |
| const [numberOfLeapYears, setNumberOfLeapYears] = useState<number>(5); | |
| const [leapYears, setLeapYears] = useState<number[]>([]); | |
| const calculateLeapYears = () => { | |
| const currentYear = new Date().getFullYear(); | |
| const calculatedLeapYears: number[] = []; | |
| let year = currentYear; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { useState } from 'react'; | |
| import Confetti from 'react-confetti'; | |
| export default function Home() { | |
| const [isExploding, setIsExploding] = useState(false); | |
| const handleClick = () => { | |
| setIsExploding(true); | |
| setTimeout(() => setIsExploding(false), 5000); // Confetti lasts for 5 seconds | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { useRef, useCallback } from 'react'; | |
| import ReactCanvasConfetti from 'react-canvas-confetti'; | |
| export default function HomePage(): JSX.Element { | |
| const confettiRef = useRef<any>(null); | |
| const handleConfetti = useCallback(() => { | |
| if (confettiRef.current) { | |
| confettiRef.current({ | |
| spread: 60, |
NewerOlder