Skip to content

Instantly share code, notes, and snippets.

@looping
looping / gist:8448177
Last active January 3, 2016 10:19
CFBundleVersion
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion `cd ${PROJECT_DIR} && git rev-list head | sort | wc -l | awk '{print $1}'`" "${INFOPLIST_FILE}"
@looping
looping / gist:8592526
Last active January 4, 2016 07:59
Fix MAC OS X audio issue
sudo kextunload /System/Library/Extensions/AppleHDA.kext
sudo kextload /System/Library/Extensions/AppleHDA.kext
@looping
looping / gist:10115779
Last active August 29, 2015 13:58
- (id)fromViews:(NSArray *)views findViewWithClass:(Class)viewClass;
- (id)fromViews:(NSArray *)views findViewWithClass:(Class)viewClass {
id retView = nil;
for (UIView * subView in views) {
if ([subView isKindOfClass:[UIAlertView class]]) {
retView = subView;
break;
} else {
if ([subView.subviews count]) {
retView = [self fromViews:subView.subviews findViewWithClass:viewClass];
}
@looping
looping / gist:10115894
Last active August 29, 2015 13:58
+ (NSDateFormatter *)dateFormatter;
+ (NSDateFormatter *)dateFormatter {
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
dateFormatter.locale = [[NSLocale preferredLanguages] objectAtIndex:0];
dateFormatter.dateFormat = @"yyyy-MM-dd'T'HH:mm:ss'Z'";
return dateFormatter;
}
buildappw() {
~/Script/xctool/xctool.sh -workspace "$@".xcworkspace -scheme "$@" build
}
@looping
looping / createRoundedRectImage
Created July 23, 2014 06:08
+ (UIImage *)createRoundedRectImage:(UIImage*)image radius:(NSInteger)r;
static void addRoundedRectToPath(CGContextRef context, CGRect rect, float ovalWidth, float ovalHeight) {
float fw, fh;
if (ovalWidth == 0 || ovalHeight == 0) {
CGContextAddRect(context, rect);
return;
}
CGContextSaveGState(context);
CGContextTranslateCTM(context, CGRectGetMinX(rect), CGRectGetMinY(rect));
@looping
looping / rm AppleSetupDone
Created July 24, 2014 07:12
Looks like a new Apple device :D
sbin/mount -uaw #
rm /var/db/.AppleSetupDone
reboot
@looping
looping / daysRemainInCurrentMonth
Created August 7, 2014 12:28
Days remaining in current month
static NSInteger daysRemainInCurrentMonth () {
return ([[NSCalendar currentCalendar] rangeOfUnit:NSDayCalendarUnit inUnit:NSMonthCalendarUnit forDate:[NSDate date]].length - [[({NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; [formatter setDateFormat:@"dd"]; formatter;}) stringFromDate:[NSDate date]] integerValue]);
}
@looping
looping / gist:3c19f75d0ef8f8767153
Created August 12, 2014 10:42
/path/to is not writable.
sudo chown -R $USER /path/to
@looping
looping / gist:1fdc20c8334451fd10ab
Created August 12, 2014 10:47
autoreconf: failed to run glibtoolize: No such file or directory
brew install libtool
brew link libtool