Skip to content

Instantly share code, notes, and snippets.

Martin Finke martinfinke

View GitHub Profile
@martinfinke
martinfinke / create_single_header.py
Created Dec 4, 2018
Convert a C++ library to a single-header file
View create_single_header.py
#!/usr/bin/env python2
import argparse
from itertools import ifilter
import os
import re
import sys
# STL and C headers as of 04.12.2018, taken from cppreference.com
stl_headers = ['algorithm', 'any', 'array', 'assert.h', 'atomic', 'bit', 'bitset', 'cassert', 'ccomplex', 'cctype', 'cerrno', 'cfenv', 'cfloat', 'charconv', 'chrono', 'cinttypes', 'ciso646', 'climits', 'clocale', 'cmath', 'codecvt', 'compare', 'complex', 'complex.h', 'concepts', 'condition_variable', 'contract', 'csetjmp', 'csignal', 'cstdalign', 'cstdarg', 'cstdbool', 'cstddef', 'cstdint', 'cstdio', 'cstdlib', 'cstring', 'ctgmath', 'ctime', 'ctype.h', 'cuchar', 'cwchar', 'cwctype', 'deque', 'errno.h', 'exception', 'execution', 'experimental/algorithm', 'experimental/any', 'experimental/array', 'experimental/atomic', 'experimental/barrier', 'experimental/chrono', 'experimental/deque', 'experimental/exception_list', 'experimental/execution_policy', 'experimental/filesystem', 'experimental/forward_list', 'experimental/functional', 'experimental/f
@martinfinke
martinfinke / gist:38f105c32eec0cc3e87fb7c9a4f6f26a
Created Dec 18, 2017 — forked from nielsbot/gist:5155671
A wrapper around kqueue to monitor changes to files. Works on iOS.
View gist:38f105c32eec0cc3e87fb7c9a4f6f26a
#import "FileChangeObserver.h"
#undef Assert
#define Assert(COND) { if (!(COND)) { raise( SIGINT ) ; } }
@interface FileChangeObserver ()
@property ( nonatomic, readonly ) int kqueue ;
@property ( nonatomic ) enum FileChangeNotificationType typeMask ;
@end
View EventEmitter.cpp
//
// Copyright (c) 2014 Sean Farrell
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
You can’t perform that action at this time.