Lotechnica

Technical writings by Nathan Shafer

The Stock Market Game, made easy with Phoenix LiveView

A couple years ago my wife, who is an 8th grade US History teacher, came to me for help with a spreadsheet to simulate the US stock market leading up to the crash in 1929. The spreadsheet was cumbersome, very complicated for the students, and a major pain for her … Read more

Dynamic configuration for Phoenix Endpoints

Update 2024-04-10: This article has been updated with a better Workaround that uses your generated MyappWeb.Endpoint.start_link/1. The original article called directly into Phoenix.Endpoint.Supervisor which was more brittle. In Phoenix 1.7.11, the Endpoint.init/2 callback was deprecated. If you have defined it, then … Read more

Prefix normalize.css or sanitize.css before gulp-sass

A pretty common setup for front-end design work is to use Sass to compile .scss files into a single .css file. It's also pretty common to use a CSS Reset, such as normalize.css or sanitize.css, to reset your CSS to a common base. For that CSS Reset to … Read more

Fix Django's runserver when run under Docker or PyCharm

When running Django's runserver management command in a Docker container or under a PyCharm run configuration (in Linux at least), I very often had issues with the process not getting killed in a timely manner. The symptom is that the process doesn't die immediately after it receives a SIGTERM or … Read more