Skip to content

Instantly share code, notes, and snippets.

Frank Schmitt frankus

  • Bellingham, WA, USA
Block or report user

Report or block frankus

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
frankus / gist:f13830ea658bed55ca41
Created Aug 13, 2015
Updates Xcode's default file-header comment to correct filename
View gist:f13830ea658bed55ca41
find . -iname '*.[mh]' -print0 | while IFS= read -r -d '' file; do basename=`basename "$file"`; sed -i .bak "2s|// .*\$|// $basename|" "$file"; done
frankus / gist:5ce28924819a812a2035
Created Aug 12, 2015
One-liner to find filenames whose header comments no longer match
View gist:5ce28924819a812a2035
find . -iname "*.[mh]" -exec sed -n "2s|^// ||p" "{}" \; -exec basename "{}" \; | uniq -u

Keybase proof

I hereby claim:

  • I am frankus on github.
  • I am frankus ( on keybase.
  • I have a public key whose fingerprint is 2A7F B0A5 A84C 5A18 8750 94B6 242B C728 204F BB64

To claim this, I am signing this object:

View gist:c0fa1b732b073810e9c8
+ (NSValueTransformer *)URLArrayTransformer {
return [MTLValueTransformer reversibleTransformerWithForwardBlock:^NSArray *(NSArray *URLStrings) {
NSMutableArray *result = [NSMutableArray arrayWithCapacity:[URLStrings count]];
for (NSString *URLString in URLStrings) {
[result addObject:[NSURL URLWithString:URLString]];
return result;
} reverseBlock:^NSArray *(NSArray *URLs) {
NSMutableArray *result = [NSMutableArray arrayWithCapacity:[URLs count]];
for (NSURL *URL in URLs) {
View ExtendedCollectionView.h
// ExtendedCollectionView.h
// Created by Frank Schmitt on 7/11/14.
@interface ExtendedCollectionView : UICollectionView
@property (nonatomic) UIEdgeInsets touchAreaInsets;
frankus / AffectedRows.m
Last active Aug 29, 2015
Switch between sorted arrays with intelligent animations
View AffectedRows.m
Returns the index paths of the rows affected by switching between two
sorted (but not necessarily unique) arrays.
@param old The array to be switched from.
@param new The array to be switched to.
@param keyPath the key path to compare ("@self" to use raw value)
@return An array of three arrays, the first containing index paths
for modified rows, the second for deleted rows, and the third for
frankus / gist:e9660a376451f21e73f3
Created Aug 20, 2014
Pretty good (North America only) phone number UITextField
View gist:e9660a376451f21e73f3
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
if (textField == self.myPhoneTextField) {
NSString *newText = [textField.text stringByReplacingCharactersInRange:range withString:string];
BOOL deleting = [newText length] < [textField.text length];
NSString *stripppedNumber = [newText stringByReplacingOccurrencesOfString:@"[^0-9]" withString:@"" options:NSRegularExpressionSearch range:NSMakeRange(0, [newText length])];
NSUInteger digits = [stripppedNumber length];
if (digits > 10)
stripppedNumber = [stripppedNumber substringToIndex:10];
frankus / UIImageView+MapSnapshot.h
Created Mar 31, 2014
MKMapSnapshot category on UIImageView
View UIImageView+MapSnapshot.h
// UIImageView+MapSnapshot.h
// Awning
// Created by Frank Schmitt on 3/31/14.
#import <UIKit/UIKit.h>
#import <MapKit/MapKit.h>
frankus / gist:7992755
Created Dec 16, 2013
Category on UIBarButtonItem for flexible space (add an `autorelease` call for non-ARC code).
View gist:7992755
@interface UIBarButtonItem (FlexibleSpace)
+ (instancetype)barButtonItemFlexibleSpace;
@implementation UIBarButtonItem (FlexibleSpace)
+ (instancetype)barButtonItemFlexibleSpace {
return [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
You can’t perform that action at this time.