Skip to content

Instantly share code, notes, and snippets.

View mwahlig's full-sized avatar

Matt Wahlig mwahlig

View GitHub Profile
@mwahlig
mwahlig / gist:af5e4751ef9a69314c01
Created June 27, 2014 04:39
Clear Derived Data Module Cache Command
rm -rf ~/Library/Developer/Xcode/DerivedData/ModuleCache/*
@mwahlig
mwahlig / gist:605ddf895bb56e2e511f
Created November 21, 2014 06:18
Script to turn TODO/FIXME into warnings in Xcode
KEYWORDS="TODO:|FIXME:|\?\?\?:|\!\!\!:"
find "${SRCROOT}" \( -name "*.h" -or -name "*.m" \) -print0 | xargs -0 egrep --with-filename --line-number --only-matching "($KEYWORDS).*\$" | perl -p -e "s/($KEYWORDS)/ warning: \$1/"
@mwahlig
mwahlig / gist:1918ea21114ae38c0ccc
Created November 26, 2014 16:35
CoreGraphics symbolic breakpoint

Set a symbolic breakpoint for the symbol CGPostError

@mwahlig
mwahlig / gist:8045acfaa3bf5768a938
Last active August 29, 2015 14:13
Print iOS application directory on box
// Objective-C
NSLog(@"app dir: %@",[[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject]);
// Swift
println("app dir: \(NSArray(array:NSFileManager.defaultManager().URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask)).lastObject)")
@mwahlig
mwahlig / gist:1eface9c6e89c34b9e08
Created June 8, 2015 16:19
Recursively Print Child VC
- (void)printChildControllersForViewControllerRecursively:(UIViewController *)controller {
NSMutableString *logString = [NSMutableString stringWithString:[NSString stringWithFormat:@"child controllers for controller: %@ ::: [", controller]];
for (UIViewController *childController in controller.childViewControllers) {
[logString appendString:[NSString stringWithFormat:@"child: %@", childController]];
[self printChildControllersForViewControllerRecursively:childController];
}
NSLog(@"%@]",logString);
}
@mwahlig
mwahlig / printCallingFunction.m
Created August 7, 2015 17:40
Print name of calling function to debug log
NSArray *syms = [NSThread callStackSymbols];
if ([syms count] > 1) {
NSLog(@"<%@ %p> %@ - caller: %@ ", [self class], self, NSStringFromSelector(_cmd),[syms objectAtIndex:1]);
} else {
NSLog(@"<%@ %p> %@", [self class], self, NSStringFromSelector(_cmd));
}
@mwahlig
mwahlig / font-families.swift
Created November 7, 2016 22:23
Print Available Font Families
// Swift 2.3
UIFont.familyNames().sort().forEach({print($0)})
// Swift 3.0
UIFont.familyNames.sorted().forEach({print($0)})
@mwahlig
mwahlig / ZipManyPublisher.swift
Last active February 17, 2024 02:15
a Combine Publisher that allows for zipping an array of publishers while maintaining their index
extension Publishers {
private struct IndexedResult<T> {
let index: Int
let result: T
}
private struct IndexedPublisher<Upstream>: Publisher where Upstream: Publisher {
typealias Output = IndexedResult<Upstream.Output>
typealias Failure = Upstream.Failure