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
//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 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 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 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 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 | |
require 'mechanize' | |
require 'parallel' | |
def should_follow_url(h) | |
return [ | |
h.size > 0, | |
!h.include?(".."), | |
!h.include?("//"), |
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
-(id)retain | |
{ | |
NSIncrementExtraRefCount(self); | |
return self; | |
} | |
-(void)release | |
{ | |
if(NSDecrementExtraRefCountWasZero(self)) | |
{ |
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 | |
import UIKit | |
class ViewPool { | |
private var freeViews: [UIView] = [] | |
private var allViews: [UIView] = [] | |
init() { | |
} |
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 asm_atoi.S... | |
fbld (%rdi) | |
fstpl -8(%rbp) | |
movq -8(%rbp), %xmm0 | |
// in main.c... | |
int main(int argc, const char * argv[]) { | |
const char *c = "2384"; | |
char b[10] = {0}; | |
for (int i = 0; i < sizeof(c); i++) { |
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
// Note that this checker is always running, even when the app is in the background (where it doesn't matter if the main thread is blocked) | |
// You'll have to add more code if you don't want the checker to run while the app is in the background | |
final class ANRChecker { | |
private let ANRThreshold: CFTimeInterval = 5 | |
// This variable may be accessed from multiple threads at the same time. It won't cause issues, but if you want prevent the thread sanitizer from complaining, you can add locking around it or w/e | |
private lazy var lastResponseTime: CFTimeInterval = CACurrentMediaTime() | |
func beginChecking() { | |
updateLastResponseTime() |
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 "fishhook.h" // from https://github.com/facebook/fishhook | |
// Replace write and writev, the two "chokepoint" functions that writes to stderr and stdout will probably pass through | |
static int (*originalWritev)(int fd, const struct iovec *v, int n); | |
static int (*originalWrite)(int fd, const void *buf, size_t size); | |
void checkForBadConstraintsMessage(int fd, const char *string, size_t size) { | |
if (strnstr(string, "UIViewAlertForUnsatisfiableConstraints", size)) { | |
// Write it to the console anyways before crashing | |
originalWrite(fd, string, size); |