A "Best of the Best Practices" (BOBP) guide to developing in Python.
- "Build tools for others that you want to be built for you." - Kenneth Reitz
- "Simplicity is alway better than functionality." - Pieter Hintjens
| # dont do this | |
| this_function_name(foo, bar | |
| baz) | |
| # do this | |
| cramers_version( | |
| foo, bar, baz) | |
| # allow this | |
| cramers_version(foo, bar, |
In 2015, I started diving deeper into GNU Emacs because I saw its potential as an assistive technology. Not only as a way of providing better access to books and code for my students and clients, many of whom are blind, but also as a tool for creating more accessible content. Regular expressions and modes like Org, Markdown, and AucTex are extremely useful in the production of alternate formats.
Although I had used Emacs as a vanilla text editor off and on since the 90's, I didn't learn anything about the underlying Emacs Lisp (elisp) programming language until the end of 2015, when I got a hardcopy Emacs manual, quit my day job, and grew t
| git log --author="Linus Torvalds" --date=iso | perl -nalE 'if (/^Date:\s+[\d-]{10}\s(\d{2})/) { say $1+0 }' | sort | uniq -c|perl -MList::Util=max -nalE '$h{$F[1]} = $F[0]; }{ $m = max values %h; foreach (0..23) { $h{$_} = 0 if not exists $h{$_} } foreach (sort {$a <=> $b } keys %h) { say sprintf "%02d - %4d %s", $_, $h{$_}, "*"x ($h{$_} / $m * 50); }' | |
On a Windows machine, you'll first need Visual Studio (the free version is fine). Once that's complete:
vcvarsall.bat in your VS installation path, then call it with x64 as it's argument. It will look something like: call "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" x64cl main.c -nologo -Zi -link user32.libThat should compile and generate main.exe.
| // example how to set up OpenGL core context on Windows for rendering to multiple windows | |
| #define WINDOW_COUNT 4 // how many windows we'll be opening? | |
| // important extension functionality used here: | |
| // (4.3) KHR_debug: https://www.khronos.org/registry/OpenGL/extensions/KHR/KHR_debug.txt | |
| // (4.5) ARB_direct_state_access: https://www.khronos.org/registry/OpenGL/extensions/ARB/ARB_direct_state_access.txt | |
| // (4.1) ARB_separate_shader_objects: https://www.khronos.org/registry/OpenGL/extensions/ARB/ARB_separate_shader_objects.txt | |
| // (4.2) ARB_shading_language_420pack: https://www.khronos.org/registry/OpenGL/extensions/ARB/ARB_shading_language_420pack.txt | |
| // (4.3) ARB_explicit_uniform_location: https://www.khronos.org/registry/OpenGL/extensions/ARB/ARB_explicit_uniform_location.txt |
| // example how to set up WebGPU rendering on Windows in C | |
| // uses Dawn implementation of WebGPU: https://dawn.googlesource.com/dawn/ | |
| // download pre-built Dawn webgpu.h/dll/lib files from https://github.com/mmozeiko/build-dawn/releases/latest | |
| #include "webgpu.h" | |
| #define _CRT_SECURE_NO_DEPRECATE | |
| #define WIN32_LEAN_AND_MEAN | |
| #include <windows.h> |
| // | |
| // Say you're making some kind of game that involves "Nodes" being placed around | |
| // the game world, and you want to make an editor mode (disabled in release | |
| // builds) that lets you create and manipulate these Nodes. | |
| // | |
| // Setting aside data serialization and an undo/redo system, here is a way that | |
| // you could make such an editor system, that gives you an immediate-mode-ish | |
| // API for easily creating editor-mode "widgets" each frame, with specific | |
| // interaction and rendering behaviors for each different kind of "widget". | |
| // |