Skip to content

Instantly share code, notes, and snippets.

void Main()
{
var digits = Digits.Create("093884765");
var digitsOfLength3 = Digits3.Create("007");
Console.WriteLine($"digits: [{digits}] digitsOfLength3: [{digitsOfLength3}]");
}
static class DigitsDef
{

This document has moved!

It's now here, in The Programmer's Compendium. The content is the same as before, but being part of the compendium means that it's actively maintained.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Things that programmers don't know but should

(A book that I might eventually write!)

Gary Bernhardt

I imagine each of these chapters being about 2,000 words, making the whole book about the size of a small novel. For comparison, articles in large papers like the New York Times average about 1,200 words. Each topic gets whatever level of detail I can fit into that space. For simple topics, that's a lot of space: I can probably walk through a very basic, but working, implementation of the IP protocol.

/**
* A C macro for easily defining lambda functions.
*
* Source: http://stackoverflow.com/a/3378514/1146898
*
* Usage:
*
* int (*max)(int, int) = lambda (int, (int x, int y) { return x > y ? x : y; });
*/
#define lambda(return_type, function_body) \
@mouseroot
mouseroot / winapp.py
Created August 1, 2013 05:40
Win32 CreateWindow example in python
from ctypes import *
from ctypes.wintypes import *
WNDPROCTYPE = WINFUNCTYPE(c_int, HWND, c_uint, WPARAM, LPARAM)
WS_EX_APPWINDOW = 0x40000
WS_OVERLAPPEDWINDOW = 0xcf0000
WS_CAPTION = 0xc00000