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
| from dataclasses import dataclass | |
| from pygame import Vector2 | |
| import pygame | |
| import math | |
| @dataclass | |
| class Circle: | |
| center: Vector2 | |
| radius: float |
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
| from pathlib import Path | |
| from platformdirs import PlatformDirs | |
| __all__ = ['path'] | |
| app_dirs = PlatformDirs('AppName', 'AppAuthor') # change this | |
| here = Path(__file__).absolute().parent | |
| SCHEMES = { |
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
| from typing import Self | |
| import math | |
| import io | |
| type Number = int | float | |
| type TVec = tuple[Number, Number] | |
| class Vector: | |
| repr_precision = 6 |
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 sys | |
| import pygame | |
| pygame.init() | |
| screen = pygame.display.set_mode((800, 600)) | |
| clock = pygame.time.Clock() | |
| class Triangle(pygame.sprite.Sprite): |
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
| class List: | |
| _head: 'Node|None' | |
| _tail: 'Node|None' | |
| def __init__(self): | |
| self.reversed = False | |
| self._head = None | |
| self._tail = None | |
| def append(self, value): |
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
| def which() -> str: | |
| print(f'1) Correct!\n2) My number is smaller.\n3) My number is bigger') | |
| while True: | |
| res = input('Type 1, 2 or 3: ') | |
| if not res.isdecimal() or int(res) not in (1, 2, 3): | |
| print('Invalid input!') | |
| continue | |
| break | |
| return ['correct', 'smaller', 'bigger'][int(res) - 1] |
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 os | |
| import shutil | |
| from contextlib import ExitStack | |
| def create_folder(stack: ExitStack, path): | |
| try: | |
| os.mkdir(path) | |
| except FileExistsError: | |
| pass |
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
| from collections.abc import Iterable | |
| import math | |
| import heapq | |
| import random | |
| from collections import deque | |
| import time | |
| type WeightedOptions = list[tuple[int, int]] | |
| UP = 0b1000 |
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 re | |
| def extract_variables(endpoint: str): | |
| """ | |
| Very simple route "parsing" using regex: | |
| The route: | |
| "/item/{item_id}" |
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
| <?php | |
| namespace Vendor\MyExt\Xclass; | |
| use TYPO3\CMS\Core\Http\ServerRequest; | |
| use TYPO3\CMS\Core\Http\Uri; | |
| use TYPO3\CMS\Core\Routing\SiteMatcher; | |
| use TYPO3\CMS\Core\Site\Entity\NullSite; | |
| use TYPO3\CMS\Core\Site\Entity\Site; | |
| use TYPO3\CMS\Core\Utility\GeneralUtility; |