I hereby claim:
- I am frankus on github.
- I am frankus (https://keybase.io/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:
| @interface UIBarButtonItem (FlexibleSpace) | |
| + (instancetype)barButtonItemFlexibleSpace; | |
| @end | |
| @implementation UIBarButtonItem (FlexibleSpace) | |
| + (instancetype)barButtonItemFlexibleSpace { | |
| return [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil]; |
| // | |
| // UIImageView+MapSnapshot.h | |
| // Awning | |
| // | |
| // Created by Frank Schmitt on 3/31/14. | |
| // | |
| #import <UIKit/UIKit.h> | |
| #import <MapKit/MapKit.h> |
| - (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]; |
| /** | |
| 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 |
| // | |
| // ExtendedCollectionView.h | |
| // | |
| // Created by Frank Schmitt on 7/11/14. | |
| // | |
| @interface ExtendedCollectionView : UICollectionView | |
| @property (nonatomic) UIEdgeInsets touchAreaInsets; |
| + (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) { |
I hereby claim:
To claim this, I am signing this object:
| find . -iname "*.[mh]" -exec sed -n "2s|^// ||p" "{}" \; -exec basename "{}" \; | uniq -u |
| find . -iname '*.[mh]' -print0 | while IFS= read -r -d '' file; do basename=`basename "$file"`; sed -i .bak "2s|// .*\$|// $basename|" "$file"; done |
For testability purposes (and to make things easier to reason about), sometimes it's nice if methods in a class are pure functions, that is, they don't contain any explicit or implicit references to self, or really anything other than the arguments that are passed in.
In the painfully contrived example below, method is a method (because it references both a property and another method
using self) and isEven is a pure function (because it doesn't).
class MyClass {
let number: Int
init(number: Int) {