Instantly share code, notes, and snippets.

View GitTagBundleVersion.sh
#/bin/sh
INFO=$( echo $PWD )/MyApp-Info
TAG=$( git describe --tags `git rev-list --tags --max-count=1` )
COMMIT=
GITPATH=/usr/bin:/usr/local/bin:/usr/local/git/bin
PATH=$PATH:$GITPATH; export PATH
if [ -z $( which git ) ]; then
echo "Unable to find git binary in \$GITPATH"
View gist:808151
grep github ./.git/config | sed -e 's/^.*\(github.com.*\)\.git$/\1/' -e 's/.*github\.com:*\/*/https:\/\/github.com\//' | xargs open
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;
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),
View gist:1108777
LoadModule dav_svn_module /opt/subversion/lib/svn-apache/mod_dav_svn.so
LoadModule authz_svn_module /opt/subversion/lib/svn-apache/mod_authz_svn.so
<Location "/svn">
DAV svn
SVNParentPath /usr/local/svnroot
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /etc/apache2/other/htpasswd
Require valid-user
</Location>
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]])]];
View Xcode4TestFlightintegration.sh
#!/bin/bash
#
# (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"
#LOG="/tmp/testflight.log"
View gist:1227259
cat ~/Desktop/crash1.log | awk '{ print $3 }' | xargs atos -arch armv7 -o MapBox.app.dSYM/Contents/Resources/DWARF/MapBox
View j
#!/bin/sh
ps ax | grep jekyll | grep -v grep | awk '{ print $1 }' | xargs kill
jekyll &
sleep 1
open http://localhost:4000
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) ¬