Skip to content

Instantly share code, notes, and snippets.

View hymerman's full-sized avatar

Ben Hymers hymerman

View GitHub Profile
@ishani
ishani / fancy_enum.cpp
Created December 5, 2012 00:01
Fancy C++ Enums
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <assert.h>
// ---------------------------------------------------------------------------------------------------------------------
// these are the actions used within the enum creation macro to produce output per-entry
// we break out the _ID ones to avoid triggering errors when using Clang in -Wall mode
#define FANCYENUM_DEF_ENUM(_ty) _ty,
@hymerman
hymerman / git-rm-ignored-files.sh
Last active December 16, 2015 05:48
Git remove ignored files already added to the repo. This works on windows with msysgit (tested with version 1.8.0.msysgit.0). Leaves deleted files in place because of --cached. The key part is the `-z` which makes ls-files use a null character as the delimiter, which works with xargs' -0 option to separate lines without blowing up on paths with …
#!/bin/sh
git ls-files -i -z --exclude-standard | xargs -0 -r git rm --cached
@hymerman
hymerman / gist:6858541
Created October 6, 2013 20:12
Regex for finding trailing whitespace
[^\S\r\n]+(?=\r?$)