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
// Similar to defer in Swift | |
#define pspdf_defer_block_name_with_prefix(prefix, suffix) prefix ## suffix | |
#define pspdf_defer_block_name(suffix) pspdf_defer_block_name_with_prefix(pspdf_defer_, suffix) | |
#define pspdf_defer __strong void(^pspdf_defer_block_name(__LINE__))(void) __attribute__((cleanup(pspdf_defer_cleanup_block), unused)) = ^ | |
#pragma clang diagnostic push | |
#pragma clang diagnostic ignored "-Wunused-function" | |
static void pspdf_defer_cleanup_block(__strong void(^*block)(void)) { | |
(*block)(); | |
} | |
#pragma clang diagnostic pop |
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 Foundation | |
class AsyncBlockOperation: NSOperation { | |
typealias Block = (completion: () -> Void) -> Void | |
private lazy var executingAccessQueue = dispatch_queue_create("eu.ricardopereira.AsyncBlockOperation.executing", DISPATCH_QUEUE_CONCURRENT) | |
private var _executing = false | |
private lazy var finishedAccessQueue = dispatch_queue_create("eu.ricardopereira.AsyncBlockOperation.finished", DISPATCH_QUEUE_CONCURRENT) | |
private var _finished = false |
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
/* Login button text */ | |
"login-button" = "Log in"; | |
/* Logout button text */ | |
"logout-button" = "Log out"; | |
/* Back button text */ | |
"back-button" = "Back"; | |
/* No data label */ |
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
// | |
// FloatingPoint+Scale.swift | |
// Swiftilities | |
// | |
// Created by Zev Eisenberg on 4/15/16. | |
// Copyright © 2016 Raizlabs. All rights reserved. | |
// | |
public extension FloatingPoint { | |
/// Re-maps a number from one range to another. |
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 "NSMutableArray+QueueAdditions.h" | |
@implementation NSMutableArray (QueueAdditions) | |
// Add to the tail of the queue | |
- (void)enqueue:(id)object { | |
[self addObject:object]; | |
} | |
// Grab the next item in the queue, if there is one |
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
set nocompatible | |
set encoding=utf-8 nobomb | |
filetype off | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#begin() | |
" Vundle | |
Plugin 'VundleVim/Vundle.vim' |
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
class NotificationToken { | |
let token: NSObjectProtocol | |
let center: NSNotificationCenter | |
init(token: NSObjectProtocol, center: NSNotificationCenter) { | |
self.token = token | |
self.center = center | |
} |
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
// 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 |