Skip to content

Instantly share code, notes, and snippets.

View nil-ableton's full-sized avatar

Nicolas Léveillé nil-ableton

View GitHub Profile
@nil-ableton
nil-ableton / voidstar.c
Last active August 29, 2015 14:22
void* is special in C, C99, C11
/**
* Local Variables:
* compile-command: "cc -Wall -Weverything -std=c11 voidstar.c -o ./voidstar && ./voidstar"
* End:
*/
#include <stdio.h> // for printf
enum WorkType
{
@nil-ableton
nil-ableton / ctime.c
Last active July 19, 2019 22:45 — forked from mmozeiko/ctime.c
ctime.c
/* ========================================================================
$File: tools/ctime/ctime.c $
$Date: 2016/05/08 04:16:55PM $
$Revision: 7 $
$Creator: Casey Muratori $
$Notice:
The author of this software MAKES NO WARRANTY as to the RELIABILITY,
SUITABILITY, or USABILITY of this software. USE IT AT YOUR OWN RISK.
@nil-ableton
nil-ableton / clmacro.cpp
Last active June 7, 2016 17:17
spaces in macro and boost::icl
/*
Encountered while building with FASTbuild cache on a library using boost::icl
See element_iterator.hpp and ICL_INTERVAL_TYPE.
FASTbuild uses cl.exe -P to produce a pre-processed file. That file gets a const stitched onto it.
Steps to reproduce:
1- compile with cl.exe clmacro.cpp
2- compile with cl.exe -P -Ficlmacro.i.cpp clmacro.cpp && cl.exe clmacro.i.cpp
@nil-ableton
nil-ableton / debug_win32.ipp
Created January 26, 2017 13:56
Formatted debug traces on win32
#pragma once
// <DEBUG WIN32 SNIPPET...
__pragma(warning(push, 1))
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
__pragma(warning(pop))
#include <sstream>
struct Win32Debug
(require find-lisp)
(defun map-find (root-dir fn)
(dolist (filename (find-lisp-find-files root-dir ".*\\.\\(cpp\\|h\\)$"))
(with-current-buffer (find-file-noselect filename)
(apply fn)
(save-buffer)))
@nil-ableton
nil-ableton / complexity-and-strategy.org
Created March 18, 2017 22:05
complexity-and-strategy.org

Commentary on Complexity And Strategy by Terry Crowley

new functionality gets harder to add as a system gets more functional.

Diminishing returns from technological advantages

advocates for these new technologies tended to confuse the productivity

@nil-ableton
nil-ableton / self_reference_monster.cpp
Last active March 29, 2017 04:51
self reference and copy ability / movability
#include <cstddef>
#include <cstdint>
#include <cstdio>
// ptr_to_buffer make this struct not a regular type, i.e.
// not trivially copyable/moveable
struct StructA {
char* const ptr_to_buffer = buffer; // dependency to representation
size_t const buffer_size = sizeof buffer;
char buffer[64];
@nil-ableton
nil-ableton / CoreAnimationNotes.md
Last active November 1, 2017 11:24
Core Animation

@url: https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/CoreAnimation_guide/Introduction/Introduction.html

Notes about using Core Animation for Macos applications.

Introducing Core Animation

For graphics, Apple describes Core Animation as the level just below AppKit. Therefore anything we would like to achieve with AppKit has to be provided via Core Animation already.

Core Animation's main purpose is to composite layers of bitmap content onto the display. Layers are arranged in trees and their properties are animated by Core Animation.