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
// Taken from the commercial iOS PDF framework http://pspdfkit.com. | |
// Copyright (c) 2014 Peter Steinberger, PSPDFKit GmbH. All rights reserved. | |
// Licensed under MIT (http://opensource.org/licenses/MIT) | |
// | |
// You should only use this in debug builds. It doesn't use private API, but I wouldn't ship it. | |
// PLEASE DUPE rdar://27192338 (https://openradar.appspot.com/27192338) if you would like to see this in UIKit. | |
#import <objc/runtime.h> | |
#import <objc/message.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
var readline = require('readline'), | |
fs = require('fs'); | |
var LinkMap = function(filePath) { | |
this.files = [] | |
this.filePath = filePath | |
} | |
LinkMap.prototype = { | |
start: function(cb) { |
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 | |
=begin | |
#### DIRECTIONS #### | |
Run `/usr/bin/ruby savings.rb <path to executable>`, and it will report the estimated savings for that executable. | |
*However*, the executable cannot have been downloaded from the app store (or else it will already be the encrypted version, and we can't unencrypt it to calculate the savings) | |
Also, it should be a binary for a specific architecture, and not a fat binary. I'd assume arm64 would be way to go. | |
How to get an arm64 binary that is not encrypted? | |
Run Product -> Archive in Xcode, then export the app Ad Hoc, and for the device to thin for, select a device with arm64 (an iPhone 5s or above) | |
Unzip the .ipa file that was exported, and Payload/<app name>.app/<app name> should be the executable that you want |
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() |