Skip to content

Instantly share code, notes, and snippets.

Justin R. Miller incanus

View GitHub Profile
incanus /
Created Dec 22, 2010
This is an Xcode build script that will automatically change your app's Info.plist CFBundleVersion string to match the latest git tag for the working copy. If you have commits beyond the last tagged one, it will append a 'd' to the number.
INFO=$( echo $PWD )/MyApp-Info
TAG=$( git describe --tags `git rev-list --tags --max-count=1` )
if [ -z $( which git ) ]; then
echo "Unable to find git binary in \$GITPATH"
incanus / gist:808151
Created Feb 2, 2011
This is a shell script to open the current Git repository on GitHub in the default browser. Only works at the top level of the working copy and on Mac OS X (for now).
View gist:808151
grep github ./.git/config | sed -e 's/^.*\(*\)\.git$/\1/' -e 's/.*github\.com:*\/*/https:\/\/\//' | xargs open
incanus / gist:926686
Created Apr 19, 2011
live move of UIPopoverController
View gist:926686
// check that popover won't try to move off-screen; dismiss if so
CGFloat pX = newAttachPoint.x;
CGFloat pY = newAttachPoint.y;
CGFloat pWidth = balloon.popoverContentSize.width;
CGFloat pHeight = balloon.popoverContentSize.height;
CGFloat mWidth = map.bounds.size.width;
CGFloat mHeight = map.bounds.size.height;
UIPopoverArrowDirection d = balloon.popoverArrowDirection;
incanus / gist:1045095
Created Jun 24, 2011
constrained override for -[RMMapContents moveBy:] in route-me
View gist:1045095
- (void)moveBy:(CGSize)delta
// Adjust delta as necessary to constrain latitude, but not longitude.
// This is largely borrowed from -[RMMapView setConstraintsSW:NE:] and -[RMMapView moveBy:]
RMProjectedRect sourceBounds = [self.mercatorToScreenProjection projectedBounds];
RMProjectedSize XYDelta = [self.mercatorToScreenProjection projectScreenSizeToXY:delta];
CGSize sizeRatio = CGSizeMake(((delta.width == 0) ? 0 : XYDelta.width / delta.width),
incanus / gist:1108777
Created Jul 27, 2011
This is my /etc/apache2/other/svn.conf for making Subversion play with the Mac's system Apache. On Lion, I had to install CollabNet's Subversion package (the 10.6 one) to get stuff into /opt.
View gist:1108777
LoadModule dav_svn_module /opt/subversion/lib/svn-apache/
LoadModule authz_svn_module /opt/subversion/lib/svn-apache/
<Location "/svn">
DAV svn
SVNParentPath /usr/local/svnroot
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /etc/apache2/other/htpasswd
Require valid-user
View gist:1137725
NSArray *colorNames = [NSArray arrayWithObjects:@"red", @"blue", @"yellow", @"green", @"brown", @"purple", @"cyan", @"orange", @"magenta", nil];
NSMutableArray *madeColors = [NSMutableArray array];
for (int c = 0; c < [colorNames count]; c++)
[madeColors addObject:[[UIColor class] performSelector:NSSelectorFromString([NSString stringWithFormat:@"%@Color", [colorNames objectAtIndex:c]])]];
incanus /
Created Sep 1, 2011
Xcode 4 scheme Archive step Post-script for automatic TestFlight build uploading. See the blog post here:
# (Above line comes out when placing in Xcode scheme)
API_TOKEN=<TestFlight API token here>
TEAM_TOKEN=<TestFlight team token here>
SIGNING_IDENTITY="iPhone Distribution: Development Seed"
PROVISIONING_PROFILE="${HOME}/Library/MobileDevice/Provisioning Profiles/MapBox Ad Hoc.mobileprovision"
incanus / gist:1227259
Created Sep 19, 2011
symbolicate a stack trace snippet from TestFlight crash reports
View gist:1227259
cat ~/Desktop/crash1.log | awk '{ print $3 }' | xargs atos -arch armv7 -o
incanus / j
Created Oct 21, 2011
Bash script to kill old Jekyll processes, start a new one in the current directly, and open the browser to it.
View j
ps ax | grep jekyll | grep -v grep | awk '{ print $1 }' | xargs kill
jekyll &
sleep 1
open http://localhost:4000
incanus / gist:1381351
Created Nov 21, 2011
AppleScript to use Display Audio as input & output devices
View gist:1381351
tell application "System Preferences" to activate
tell application "System Events"
tell process "System Preferences"
click menu item "Sound" of menu "View" of menu bar 1
-- set output
click radio button "Output" of tab group 1 of window "Sound"
set theRows to every row of table 1 of scroll area 1 of ¬
tab group 1 of window "Sound"
repeat with aRow in theRows
if (value of text field 1 of aRow as text) ¬
You can’t perform that action at this time.