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 currentRunloop = CFRunLoopGetCurrent() | |
print("Before delay") | |
delay(3.0) { | |
print("Delay execution") | |
CFRunLoopPerformBlock(currentRunloop, NSRunLoopCommonModes) { | |
print("Perform block") | |
} | |
CFRunLoopWakeUp(currentRunloop) | |
} | |
print("After delay") |
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
class ViewController: UIViewController { | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
} | |
override func viewDidAppear(_ animated: Bool) { | |
super.viewDidAppear(animated) | |
let photoURL1 = URL(string: "https://i.imgur.com/Si2l3kd.png")! | |
//let photoURL2 = URL(string: "https://jxccsa.bn1.livefilestore.com/y2m5XyfjXFW78kXvn3-McCXl5926JSzKH-n7hysppnCZxn_hnMPjwWA2dT11K_pInOZYJArvCzlh0_Aozw2ZK_4sBMspJx23DN1kNX8IfRW4_cBuasM9pEUvOTup6p9KCCm/AE1.jpg?psid=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
import Foundation | |
/// Protocols confoming to this protocol will have a mock generated for them. | |
protocol AutoMockable {} | |
protocol DataServiceProtocol: AutoMockable { | |
func fetchResource(fromURL url: URL, onComplete: (Result)-> Void) | |
} |
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
class ViewController: UIViewController { | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
// by calling [NSURLProtocol registerClass:[MyURLProtocol class]]; in -application:didFinishLoadingWithOptions:, your protocol will have priority over any of the built-in protocols. | |
URLProtocol.registerClass(ActivityURLProtocol.self) | |
//URLProtocol.unregisterClass(ActivityURLProtocol.self) | |
print(URLSession.shared.configuration.protocolClasses) | |
} |
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
// | |
// StoryboardBackedViewController.h | |
// Fabric | |
// | |
// Created by Javier Soto on 9/6/15. | |
// Copyright © 2015 Fabric. All rights reserved. | |
// | |
#import <UIKit/UIKit.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
//===--- Result.swift -----------------------------------------------------===// | |
// | |
// This source file is part of the Swift.org open source project | |
// | |
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors | |
// Licensed under Apache License v2.0 with Runtime Library Exception | |
// | |
// See https://swift.org/LICENSE.txt for license information | |
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors | |
// |
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 Foundation | |
public typealias JSON = AnyObject | |
public protocol JSONDecodable { | |
associatedtype DecodedType = Self | |
static func decode(json: JSON) -> JSONDecoded<DecodedType> | |
} | |
public enum JSONDecoded<T> { |
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
// in a UITableViewController (or any other view controller with a UITableView) | |
- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator | |
{ | |
UIView *header = [[UIView alloc] initWithFrame:CGRectMake(0, 0, size.width, 0)]; | |
header.translatesAutoresizingMaskIntoConstraints = NO; | |
// [add subviews and their constraints to header] | |
NSLayoutConstraint *headerWidthConstraint = [NSLayoutConstraint |
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
class NotificationToken { | |
let token: NSObjectProtocol | |
let center: NSNotificationCenter | |
init(token: NSObjectProtocol, center: NSNotificationCenter) { | |
self.token = token | |
self.center = center | |
} |
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
set nocompatible | |
set encoding=utf-8 nobomb | |
filetype off | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#begin() | |
" Vundle | |
Plugin 'VundleVim/Vundle.vim' |