This file contains 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
# Let's consider some demo repository contains foo folder in its | |
# root along with some other stuff. We want to make clone of foo | |
# and preserve the history of commits for the files inside it. | |
# The new name for the foo's clone will be bar. | |
# The steps | |
# 1. Installing required dependency https://github.com/newren/git-filter-repo | |
# brew install git-filter-repo |
This file contains 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 Algorithms | |
import CollectionsBenchmark | |
// Adaptation of original solution at | |
// https://github.com/objcio/OptimizingCollections/blob/master/Sources/SortedArray.swift | |
extension Collection { | |
@inlinable | |
func partitioningIndex2( | |
where belongsInSecondPartition: (Element) throws -> Bool | |
) rethrows -> Index where Index == Int { |
This file contains 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 MRCAppDelegate | |
- (void)p_updateWindowWithRootViewController:(nullable UIViewController *)controller | |
completionBlock:(nullable dispatch_block_t)completionBlock { | |
if (!self.window) { | |
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; | |
[self.window makeKeyAndVisible]; | |
} | |
val rootViewController = self.window.rootViewController; | |
val resetRootViewControllerBlock = ^{ |
This file contains 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
// | |
// POSLens.m | |
// POSLens | |
// | |
// Created by Pavel Osipov on 06/02/2018. | |
// Copyright © 2018 Pavel Osipov. All rights reserved. | |
// | |
#import "POSLens.h" |
This file contains 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
Incident Identifier: CE2D3A63-9CB2-4885-9AF8-694903467129 | |
CrashReporter Key: 4EA4EE9A-0B10-411B-8144-593752693588 | |
Hardware Model: iPhone7,2 | |
Process: MRCloudApp [2572] | |
Path: /var/containers/Bundle/Application/4CE776FA-A9E3-4B87-B660-32D90786733A/MRCloudApp.app/MRCloudApp | |
Identifier: ru.mail.cloud | |
Version: 6.2.6 (6951) | |
Code Type: ARM-64 | |
Parent Process: ??? [1] |
This file contains 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
@interface POSThreadWatchDogReporter () | |
@property (nonatomic, readonly) NSTimeInterval threshold; | |
@property (nonatomic, readonly) POSThreadWatchDog *watchDog; | |
@end | |
@implementation POSThreadWatchDogReporter | |
- (instancetype)initWithThreshold:(NSTimeInterval)threshold { | |
POSRX_CHECK([NSThread isMainThread]); | |
thread_t thread = mach_thread_self(); |
This file contains 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 PHImageManager (MRCApp) | |
+ (RACSignal *)p_fetchALAssetForVideoAsset:(PHAsset *)asset { | |
POSRX_CHECK(asset); | |
PHVideoRequestOptions *options = [PHVideoRequestOptions new]; | |
options.version = PHVideoRequestOptionsVersionCurrent; | |
options.deliveryMode = PHVideoRequestOptionsDeliveryModeHighQualityFormat; | |
options.networkAccessAllowed = YES; | |
return [self p_fetchALAssetForAsset:asset withURL:asset.mrc_videoAssetURL]; | |
} |
This file contains 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
@interface NSInputStream (MRC) | |
+ (instancetype)mrc_inputStreamWithData:(NSData *)data; | |
@end | |
@implementation NSInputStream (MRC) | |
+ (instancetype)mrc_inputStreamWithData:(NSData *)data { | |
MRCDataStreamDataSource *dataSource = [[MRCDataStreamDataSource alloc] initWithData:data]; | |
POSBlobInputStream *stream = [[POSBlobInputStream alloc] initWithDataSource:dataSource]; | |
stream.shouldNotifyCoreFoundationAboutStatusChange = NO; | |
return stream; |
This file contains 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 "MRCDataStreamDataSource.h" | |
@interface MRCDataStreamDataSource () | |
@property (nonatomic, readonly) NSData *data; | |
@property (nonatomic) NSUInteger readOffset; | |
@property (nonatomic, getter = isOpenCompleted) BOOL openCompleted; | |
@property (nonatomic) NSError *error; | |
@end | |
@implementation MRCDataStreamDataSource |
This file contains 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
- (NSURLSessionUploadTask *)uploadData:(NSData *)data toURL:(NSURL *)URL { | |
NSMutableHTTPRequest *request = [[NSMutableHTTPRequest alloc] initWithURL:URL]; | |
request.HTTPMethod = @"PUT"; | |
request.HTTPBodyStream = [NSInputStream inputStreamWithData:data]; | |
NSURLSession *session = [NSURLSession sharedSession]; | |
NSURLSessionUploadTask *task = [session uploadTaskWithStreamedRequest:request] | |
return task; | |
} |
NewerOlder