Skip to content

Instantly share code, notes, and snippets.

View vladimirgoncharov's full-sized avatar

Goncharov Vladimir vladimirgoncharov

  • Тольятти
View GitHub Profile
@yanhsiah
yanhsiah / mutex
Created December 18, 2017 02:53
mutex lock example for objective-C
- (void)sampleMethod
{
NSOperationQueue *operationQueue = [NSOperationQueue new];
MockService *service = [MockService sharedService];
[operationQueue addOperationWithBlock:^{
NSString *key = @"url_1";
[service runServiceByKey:key];
}];
[operationQueue addOperationWithBlock:^{
@digoreis
digoreis / CURLSwift.swift
Last active May 15, 2018 20:45
test extension for curl - Update to Swift 3
//
// CURLDebug.swift
//
// Created by apple on 02/06/16.
// Copyright © 2016 Rodrigo Reis. All rights reserved.
//
import Foundation
@cabeca
cabeca / simulator_populator
Created September 23, 2014 21:30
This script removes and recreates all simulators in Xcode 6.
#!/usr/bin/env ruby
device_types_output = `xcrun simctl list devicetypes`
device_types = device_types_output.scan /(.*) \((.*)\)/
runtimes_output = `xcrun simctl list runtimes`
runtimes = runtimes_output.scan /(.*) \(.*\) \((com.apple[^)]+)\)$/
devices_output = `xcrun simctl list devices`
devices = devices_output.scan /\s\s\s\s(.*) \(([^)]+)\) (.*)/
@iwasrobbed
iwasrobbed / gist:5528897
Last active June 5, 2020 20:34
UICollectionView w/ NSFetchedResultsController & NSBlockOperation. Idea originated from Blake Watters (https://github.com/AshFurrow/UICollectionView-NSFetchedResultsController/issues/13)
- (void)controllerWillChangeContent:(NSFetchedResultsController *)controller
{
self.shouldReloadCollectionView = NO;
self.blockOperation = [[NSBlockOperation alloc] init];
}
- (void)controller:(NSFetchedResultsController *)controller didChangeSection:(id<NSFetchedResultsSectionInfo>)sectionInfo
atIndex:(NSUInteger)sectionIndex forChangeType:(NSFetchedResultsChangeType)type
{
__weak UICollectionView *collectionView = self.collectionView;