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
| # Reads foo.py, and prints the names of classes and methods inside of it. | |
| import ast | |
| def extract_structure(file_path): | |
| with open(file_path, "r", encoding="utf-8") as f: | |
| tree = ast.parse(f.read(), filename=file_path) | |
| structure = [] |
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 BreakException(Exception): | |
| pass | |
| class ContinueException(Exception): | |
| pass | |
| class ReturnException(Exception): | |
| def __init__(self, value): | |
| self.value = 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
| <!doctype html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="utf-8" /> | |
| <meta name="viewport" content="width=device-width, initial-scale=1" /> | |
| <title>Compile `print("hi")` to WASM at runtime</title> | |
| <style> | |
| body { font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Arial, "Apple Color Emoji", "Segoe UI Emoji"; margin: 2rem; } | |
| .ok { color: #0a7f2e; } | |
| .err { color: #a40000; } |
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
| // My addition is described here: https://twitter.com/welfje/status/1689701477051211776?s=20 | |
| // Source of most of this Gist: https://gist.github.com/phoboslab/a35de765a33fe5d37f7b13a31281329b | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| // ----------------------------------------------------------------------------- | |
| // Cross platform high resolution timer | |
| // From https://gist.github.com/ForeverZer0/0a4f80fc02b96e19380ebb7a3debbee5 |