This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// LCKConcurrentOperation.m | |
// LCKOperations | |
// | |
// Created by Twig on 12/19/13. | |
// Copyright (c) 2013 Lickability. All rights reserved. | |
// | |
#import "LCKConcurrentOperation.h" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Essential Xcode Shortcuts | |
🇺🇸 Keyboard | |
⌘ B Build | |
⌘ R Run | |
⌘ U Run Test | |
⇧ ⌘ K Clean | |
⌥ ⇧ ⌘ K Clean Build Folder | |
⇧ ⌘ O Open quickly |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
/// Fast, concrete text storage intended to be subclassed. | |
class BaseTextStorage: NSTextStorage { | |
// MARK: - Properties | |
private let storage = NSMutableAttributedString() | |
// MARK: - NSTextStorage |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// MXSEventTrackingWindow.h | |
// | |
// Created by Max Seelemann on 01.09.16. | |
// Copyright © 2016 The Soulmen. All rights reserved. | |
// | |
/*! | |
@abstract Special window class used for advanced event processing. | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+ (BOOL)migrateStoreAtURL:(NSURL *)storeURL | |
models:(NSArray<NSManagedObjectModel *> *)moms // @[ mom_v1, mom_v2, mom_v3 ... ]; | |
error:(NSError **)error { | |
// Find an index of the current store's mom | |
NSDictionary *meta = [NSPersistentStoreCoordinator metadataForPersistentStoreOfType:NSSQLiteStoreType URL:storeURL error:error]; | |
if (!meta) { | |
return NO; | |
} | |
NSInteger idx = [moms indexOfObjectPassingTest:^BOOL(NSManagedObjectModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { | |
return [obj isConfiguration:nil compatibleWithStoreMetadata:meta]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// UIWindow+AppSwitchScrollStopper.h | |
// Created by Tim Johnsen on 3/27/16. | |
#import <UIKit/UIKit.h> | |
@interface UIWindow (AppSwitchScrollStopper) | |
/// Call this early on in your app's lifecycle to avoid | |
/// scroll-related flashing when your app resumes from the background | |
- (void)installAppSwitchScrollStopper; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//some time, frc section may be need section offset | |
@objc public protocol MFetchedResultsControllerOffsetSectionDelegate{ | |
func offsetSection() -> Int | |
} | |
class MFetchedResultsController: NSFetchedResultsController, NSFetchedResultsControllerDelegate { | |
weak var viewController: UIViewController? //UITableViewController UICollectionViewController | |
weak var scrollView: UIScrollView? //TableView CollectionView | |
weak var offsetSectionDelegate: MFetchedResultsControllerOffsetSectionDelegate? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Drop this into your ~/.gitconfig | |
[alias] | |
delete-merged = !bash -c '\ | |
REMOTE=$1 && \ | |
REMOTE=${REMOTE:="origin"} && \ | |
echo "Fetching $REMOTE" && \ | |
git fetch $REMOTE --prune && \ | |
git branch -vv | grep "gone]" | awk \"{ print \\$1 }\" | xargs git branch -d' - | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@implementation UIFontDescriptor (DZWDynamicType) | |
+ (instancetype)dzw_preferredFontDescriptorWithTextStyle:(NSString *)style { | |
return [[self preferredFontDescriptorWithTextStyle:style] dzw_fontDescriptorWithMatchingFamily:@"Avenir Next"]; | |
} | |
- (instancetype)dzw_fontDescriptorWithMatchingFamily:(NSString *)family { | |
NSMutableDictionary *attributes = [self.fontAttributes mutableCopy]; | |
[attributes removeObjectForKey:UIFontDescriptorTextStyleAttribute]; | |
UIFontDescriptor *newDesc = (__bridge_transfer UIFontDescriptor *)CTFontDescriptorCreateCopyWithFamily((__bridge CTFontDescriptorRef)self, (__bridge CFStringRef)family); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 1. Disable centered look & animation: | |
// 1.1. Subclass NSSearchFieldCell and add: | |
- (BOOL)isCenteredLook | |
{ | |
return NO; | |
} | |
// 1.2. Subclass NSSearchField and add: |