Skip to content

Instantly share code, notes, and snippets.

@tboyce12
tboyce12 / gist:543835a7ffcf578ff5f32ffc3940ea6b
Created April 11, 2019 22:12 — forked from nielsbot/gist:5155671
A wrapper around kqueue to monitor changes to files. Works on iOS.
#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
@tboyce12
tboyce12 / bash.log
Created October 22, 2015 07:36
Build single view iOS app template, try to install with ios-deploy
$ pwd
/Users/tboyce12/Downloads/foo
$ xcodebuild -scheme foo -sdk iphoneos BUILD_DIR=$(pwd)/build &> build.log
$ ios-deploy -v -d -b build/Debug-iphoneos/foo.app &> deploy.log
@tboyce12
tboyce12 / brew-fail.txt
Last active August 29, 2015 14:25
Brew Fail
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew doctor
brew update
brew upgrade
brew tap homebrew/dupes
brew tap homebrew/versions
brew tap homebrew/homebrew-php
brew install php55 --with-phpdbg
@tboyce12
tboyce12 / cli
Created July 15, 2015 21:05
phpdbg is not supported for this version of PHP
$ brew install -v /usr/local/Library/Taps/homebrew/homebrew-php/Formula/php56.rb --with-phpdbg
==> Installing php56 from homebrew/homebrew-php
Error: phpdbg is not supported for this version of PHP
@tboyce12
tboyce12 / .bashrc
Last active December 25, 2015 17:49
Shell prompt w/user, directory, git branch with dirty status
tb_is_git_dirty() {
git_status="$(git status 2> /dev/null)"
if [[ ${git_status} =~ "nothing to commit" ]]; then
return 0
else
return 1
fi
}
__tb_git_status() {
git_status="$(git status 2> /dev/null)"
@tboyce12
tboyce12 / notes.txt
Last active December 25, 2015 17:49
Git tab completion
Download script and source it in your .bashrc or .bash_profile
http://apple.stackexchange.com/a/55886
@tboyce12
tboyce12 / .bashrc
Last active December 25, 2015 17:49
Git log w/graph, colors, abbreviations
alias gl="git log --graph --color --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(cyan)%ci%C(reset) %C(yellow)(%cr)%C(reset) %C(red)%cn%C(reset)%C(bold green)%d%C(reset)%n'' %C(black)%s%C(reset)'"
@tboyce12
tboyce12 / csv_formatter.py
Created August 29, 2013 22:40
Format CSV to work better with unix column command: - Replace commas with custom separator (except commas between double quotes) - Collapse extra whitespace, including newlines between double quotes
import argparse, re
# Arg Parser
parser = argparse.ArgumentParser(description='Prints well-formatted version of supplied CSV file to STDOUT.')
parser.add_argument('filename', metavar='FILE', type=str,
help='File to convert.')
parser.add_argument('-s', '--separator', dest='separator', type=str, default='|',
help="Character to separate fields. Default: '|' (pipe).")
# Args