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 UIPopoverPresentationController (PSPDFAdditions) | |
+ (void)load { | |
PSPDFSwizzleMethodImplementation(self, @selector(containerViewWillLayoutSubviews), ^(UIPopoverPresentationController *_self) { | |
// Refresh bar button view internals | |
[_self pspdf_updateBarButtonView]; | |
((void( *)(id, SEL))objc_msgSend)(_self, PSPDFPrefixedSelector(containerViewWillLayoutSubviews)); | |
}); | |
} |
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
// | |
// CLLocation+rhextensions.h | |
// | |
// Copyright (C) 2015 by Christopher Meyer | |
// http://schwiiz.org/ | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a copy | |
// of this software and associated documentation files (the "Software"), to deal | |
// in the Software without restriction, including without limitation the rights | |
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
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
/// Observes a run loop to detect any stalling or blocking that occurs. | |
/// | |
/// This class is thread-safe. | |
@interface GHRunLoopWatchdog : NSObject | |
/// Initializes the receiver to watch the specified run loop, using a default | |
/// stalling threshold. | |
- (id)initWithRunLoop:(CFRunLoopRef)runLoop; | |
/// Initializes the receiver to detect when the specified run loop blocks for |
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 i8 = Int8(42) | |
let i16 = Int16(42) | |
let i32 = Int32(42) | |
let i64 = Int64(42) | |
^i8 + i16 | |
let f = Float(42.0) | |
let cgf = CGFloat(42.0) | |
let d = Double(42.0) |
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
// See: https://devforums.apple.com/message/1000934#1000934 | |
import Foundation | |
// Logic | |
operator prefix ¬ {} | |
@prefix func ¬ (value: Bool) -> Bool { | |
return !value | |
} |
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 NSManagedObjectContext (PWExtensions) | |
#ifndef NDEBUG | |
// Core Data uses exceptions to notify itself about optimistic locking failures. These exceptions are intercepted by | |
// Core Data and never reach the client code. Such an exception should not drop in the debugger because it is not raised | |
// due to a programming error. | |
// Since the exception is thrown inside -[NSManagedObjectContext save:], this category is a logical place to install | |
// the filter. | |
+ (void) load | |
{ |
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
// | |
// RSTimingFunction.h | |
// | |
// Created by Raphael Schaad on 2013-09-28. | |
// This is free and unencumbered software released into the public domain. | |
// | |
#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
module Kaminari | |
module PageScopeMethods | |
def total_count | |
@_hacked_total_count || (@_hacked_total_count = self.connection.execute("SELECT (reltuples)::integer FROM pg_class r WHERE relkind = 'r' AND relname ='#{table_name}'").first["reltuples"].to_i) | |
end | |
end | |
end |
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 <UIKit/UIKit.h> | |
@interface AlzheimerPageViewController : UIViewController | |
- (instancetype) initWithTransitionStyle: (UIPageViewControllerTransitionStyle) transitionStyle navigationOrientation:(UIPageViewControllerNavigationOrientation)navigationOrientation options:(NSDictionary *)options; | |
- (void) setViewControllers: (NSArray*) viewControllers direction:(UIPageViewControllerNavigationDirection)direction animated:(BOOL)animated completion:(void (^)(BOOL))completion; | |
@property (nonatomic, weak) id<UIPageViewControllerDataSource> dataSource; | |
@property (nonatomic, weak) id<UIPageViewControllerDelegate> delegate; | |
@property (nonatomic, readonly) NSArray* viewControllers; |
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
// Smart little helper to find main thread hangs. Enable in appDidFinishLaunching. | |
// Only available with source code in DEBUG mode. | |
@interface PSPDFHangDetector : NSObject | |
+ (void)startHangDetector; | |
@end | |
@implementation PSPDFHangDetector | |
+ (void)startHangDetector { | |
#ifdef DEBUG |