Skip to content

Instantly share code, notes, and snippets.

View lassebenni's full-sized avatar

Lasse Benninga lassebenni

View GitHub Profile
@lassebenni
lassebenni / falsy_surprises.cast
Created January 26, 2026 17:15
Terminal Tutorial: Falsy Surprises
{"version":2,"width":80,"height":24,"timestamp":1769447734,"command":"python3 actor_falsy.py","env":{"SHELL":"/bin/zsh"}}
[0.277347, "o", "$ python3\r\n"]
[0.77879, "o", ">>> d"]
[0.863041, "o", "e"]
[0.912524, "o", "f"]
[0.96364, "o", " "]
[1.003149, "o", "p"]
[1.055266, "o", "r"]
[1.113456, "o", "o"]
[1.168113, "o", "c"]
@lassebenni
lassebenni / import_side_effects.cast
Created January 26, 2026 17:15
Terminal Tutorial: Import Side-effects
{"version":2,"width":80,"height":24,"timestamp":1769447724,"command":"python3 actor_import.py","env":{"SHELL":"/bin/zsh"}}
[0.24671, "o", "$ cat my_utils.py\r\ndef clean(v): return v.strip()\r\nprint(\"CLEANUP STARTED...\") # Loose code!\r\n\r\n"]
[1.244953, "o", "$ python3\r\n"]
[1.749037, "o", ">>> f"]
[1.812368, "o", "r"]
[1.887767, "o", "o"]
[1.94202, "o", "m"]
[1.974814, "o", " "]
[2.009777, "o", "m"]
[2.089779, "o", "y"]
@lassebenni
lassebenni / reference_trap.cast
Created January 26, 2026 17:15
Terminal Tutorial: Reference Trap
{"version":2,"width":80,"height":24,"timestamp":1769447709,"command":"python3 actor_reference.py","env":{"SHELL":"/bin/zsh"}}
[1.445624, "o", "$ python3\r\n"]
[1.942448, "o", "Python 3.11.4 (main, Jun 7 2023, 10:13:09) on darwin\r\n>>> o"]
[1.978087, "o", "r"]
[2.044075, "o", "i"]
[2.118979, "o", "g"]
[2.153101, "o", "i"]
[2.231728, "o", "n"]
[2.275809, "o", "a"]
[2.338374, "o", "l"]
@lassebenni
lassebenni / float_precision.cast
Created January 26, 2026 17:05
Terminal Tutorial: Float Precision
{"version":2,"width":80,"height":24,"timestamp":1769447134,"command":"python3 actor_float.py","env":{"SHELL":"/bin/zsh"}}
[0.104455, "o", "$ python3\r\n"]
[0.608686, "o", "Python 3.11.4 (main, Jun 7 2023, 10:13:09) [Clang 14.0.0 (clang-1400.0.29.202)] on darwin\r\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\r\n>>> "]
[1.109006, "o", "0"]
[1.153275, "o", "."]
[1.23123, "o", "1"]
[1.28804, "o", " "]
[1.319911, "o", "+"]
[1.369582, "o", " "]
[1.447159, "o", "0"]
@lassebenni
lassebenni / shadowing.cast
Created January 26, 2026 17:05
Terminal Tutorial: Shadowing Built-ins
{"version":2,"width":80,"height":24,"timestamp":1769447121,"command":"python3 actor_shadowing.py","env":{"SHELL":"/bin/zsh"}}
[0.123841, "o", "$ python3\r\n"]
[0.624555, "o", "Python 3.11.4 (main, Jun 7 2023, 10:13:09) [Clang 14.0.0 (clang-1400.0.29.202)] on darwin\r\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\r\n>>> "]
[1.125084, "o", "m"]
[1.194775, "o", "y"]
[1.236595, "o", "_"]
[1.313656, "o", "d"]
[1.395805, "o", "a"]
[1.460993, "o", "t"]
[1.519072, "o", "a"]
@lassebenni
lassebenni / mutable_defaults.cast
Created January 26, 2026 17:05
Terminal Tutorial: Mutable Defaults
{"version":2,"width":80,"height":24,"timestamp":1769447098,"command":"python3 actor_mutable.py","env":{"SHELL":"/bin/zsh"}}
[1.258659, "o", "$ python3\r\n"]
[1.762907, "o", "Python 3.11.4 (main, Jun 7 2023, 10:13:09) [Clang 14.0.0 (clang-1400.0.29.202)] on darwin\r\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\r\n"]
[2.766521, "o", ">>> "]
[3.26899, "o", "d"]
[3.306452, "o", "e"]
[3.351715, "o", "f"]
[3.389558, "o", " "]
[3.43161, "o", "a"]
[3.472787, "o", "d"]
@lassebenni
lassebenni / mutable_immutable_animation.html
Created January 13, 2026 19:16
Animation: Mutable vs Immutable Types in Python (v4 - Fixed Alignment)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Mutable vs Immutable</title>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
display: flex;
@lassebenni
lassebenni / type_check.cast
Created January 13, 2026 18:39
Terminal Tutorial: Type Checking with type() in Python
{"version":2,"width":80,"height":24,"timestamp":1768329516,"command":"python3 type_check_actor.py","env":{"SHELL":"/bin/zsh"}}
[0.094466, "o", "\u001b[1;36m# Type Checking with type() in Python\u001b[0m\r\n\r\n"]
[1.094798, "o", ">>> t"]
[1.155136, "o", "y"]
[1.229516, "o", "p"]
[1.28968, "o", "e"]
[1.342689, "o", "("]
[1.411384, "o", "4"]
[1.467575, "o", "2"]
[1.526385, "o", ")"]
@lassebenni
lassebenni / variables_reference_animation.html
Created January 13, 2026 18:37
Animation: Variables as References in Python
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Variables as References</title>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
display: flex;
@lassebenni
lassebenni / name_main_demo.cast
Created January 13, 2026 12:39
Terminal Tutorial: __name__ == __main__ pattern
{"version":2,"width":80,"height":24,"timestamp":1768307943,"command":"python3 actor_name_main.py","env":{"SHELL":"/bin/zsh"}}
[0.093267, "o", "\r\n\u001b[1;36m=== Demonstrating: if __name__ == \"__main__\" ===\u001b[0m\r\n\r\n"]
[1.093391, "o", "\u001b[1;33m# Let's look at our module with the __main__ pattern:\u001b[0m\r\n\r\n"]
[1.59714, "o", "$ c"]
[1.636309, "o", "a"]
[1.715234, "o", "t"]
[1.791043, "o", " "]
[1.826789, "o", "d"]
[1.893022, "o", "e"]
[1.938075, "o", "m"]