Skip to Content
Skip to content
236 results
Python
Finding Files in Python With pathlib glob and rglob Level: Intermediate

glob() searches one folder, rglob() searches every folder below it. Neither sorts the results, skips folders like .venv, or matches .CSV on Linux.

Python
pip freeze vs Writing requirements.txt by Hand: Which One to Use Level: Intermediate

pip freeze gives exact versions but hides what you chose. A hand-written file shows what you chose but isn't exact.

Python
Diagnose pytest Discovery and src-Layout Import Errors Level: Intermediate

Separate zero collected tests from an import failure, install into the correct environment, and prove the selected test catches a broken assertion.

Python
Reading a Large Text File in Python Line by Line Level: Intermediate

for line in file reads one line at a time, so a 10 GB file uses almost no memory. read() and readlines() load everything.

Python
Speeding Up Many Downloads in Python With ThreadPoolExecutor Level: Advanced

Downloads spend most of their time waiting. ThreadPoolExecutor lets many waits overlap: 20 half-second downloads in 2 seconds instead of 10.

Python
Python Type Conversion: Why "5" + 5 Fails and How to Fix It Level: Beginner

Python refuses to guess whether "5" + 5 means 55 or 10.

Python
Writing Your Own Python Context Manager, With a Class or contextlib Level: Advanced

Write a context manager when something must be undone no matter how the block ends.

JavaScript
Make a Button Do Something With addEventListener Level: Beginner

Find the button, attach a listener, change something on the page when it's clicked. Three steps, and two mistakes that make it silently do nothing.

JavaScript
JavaScript Arrays in 15 Minutes Level: Beginner

Arrays hold lists: cart items, names, scores. Create them, read them, add and remove items, find things, and copy them without changing the original by accident.

JavaScript
Arrow Functions in 10 Minutes Level: Beginner

Arrow functions are a shorter way to write a function, and they are everywhere in modern JavaScript.

JavaScript
Debugging With console.log Without Drowning in Output Level: Beginner

console.log is the fastest way to see what your code is doing, until it prints 300 lines and you can't find the one that matters.