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
- (void)dealloc | |
{ | |
if (_shouldRecycle) { | |
objc_destructInstance(self); | |
[self recycle]; | |
} else { | |
[super dealloc]; | |
} | |
} |
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 "ViewController.h" | |
@interface ViewController () | |
@end | |
@interface asdf : NSObject | |
@end |
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
//Copyright (c) 2018 Michael Eisel. All rights reserved. | |
#import "CLRCallRecorder.h" | |
#import <dlfcn.h> | |
#import <libkern/OSAtomicQueue.h> | |
#import <pthread.h> | |
typedef struct { | |
void *ptr; | |
NSInteger number; |
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
//Copyright (c) 2018 Michael Eisel. All rights reserved. | |
#import <Foundation/Foundation.h> | |
// Returns all the calls that have been made, in the order that they were made. If a call is made more than once, it just records the first instance. | |
// Each time this function is called, it returns only the calls that have been made since the last time it was called | |
extern NSArray <NSString *> *CLRCollectCalls(void); |
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 UIKit | |
class MyViewController: UIViewController { | |
@IBOutlet weak var button: UIButton! | |
var vc: UIViewController? = nil | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
button.addTarget(self, action: #selector(down), for: .touchDown) |
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
func didTouchUp() { | |
let vc = DestViewController() | |
presentVC(vc) | |
} |
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
func didTouchDown() { | |
self.vc = DestViewController() | |
} | |
// about 75ms elapses here... | |
func didTouchUp() { | |
presentVC(self.vc) | |
} |
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
#!/usr/bin/ruby | |
raise "Usage: ./framework.rb <path to pbxproj file> <name of target>" unless ARGV.size == 2 | |
proj_file, name = ARGV | |
str = IO.read(proj_file).gsub("com.apple.product-type.application", "com.apple.product-type.framework").gsub("#{name}.app", "#{name}.framework") | |
IO.write(proj_file, str) |
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
extension Array { | |
func sortedWith<T: Comparable>(_ comparableTransform: (Array.Element) -> T) -> [Array.Element] { | |
return sorted(by: { (a, b) -> Bool in | |
return comparableTransform(a) > comparableTransform(b) | |
}) | |
} | |
} | |
let carts: [Card] = [] |
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
extension Array where Element: Hashable { | |
func uniqueElements() -> [Element] { | |
return uniqueElements(by: { $0 }) | |
} | |
func uniqueElements<T: Hashable>(by uniqueValue: (Element) -> T) -> [Element] { | |
var uniqueElements: [Array.Element] = [] | |
var set: Set<T> = Set() | |
for element in self { | |
let value = uniqueValue(element) |