for sim in (xcrun simctl list devices | grep "(Booted)" | grep -E -o -i "([0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12})")
xcrun simctl <command> $sim
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
{ | |
"repositories": [ | |
{ | |
"type": "path", | |
"url": "../relative/project/path" | |
} | |
], | |
"require": { | |
"${project}": "dev-${branch}" | |
} |
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
config_files = Dir.glob("#{ENV['HOME']}/Library/Application Support/Viscosity/OpenVPN/*/config.conf") | |
config_files.each do |file| | |
certificate_files = ['ca', 'cert', 'key', 'tls-auth'] | |
config_dir = File.dirname(file) | |
connection_name = nil | |
new_config = [] | |
File.read(file).each do |line| | |
line.strip! |
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 <RestKit/RestKit.h> | |
#import "CoreData+MagicalRecord.h" | |
// Use a class extension to expose access to MagicalRecord's private setter methods | |
@interface NSManagedObjectContext () | |
+ (void)MR_setRootSavingContext:(NSManagedObjectContext *)context; | |
+ (void)MR_setDefaultContext:(NSManagedObjectContext *)moc; | |
@end | |
@implementation AppDelegate |
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
/** usage example | |
@implementation ABCPlayerManager | |
+ (instancetype)sharedPlayerManager { | |
return TCM_SINGLETON(ABCPlayerManager); | |
} | |
@end | |
*/ | |
#define TCM_SINGLETON(THECLASS) ({ \ | |
static THECLASS *s_sharedInstance = nil; \ |
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
BOOL PSPDFIsUIKitFlatMode(void) { | |
static BOOL isUIKitFlatMode = NO; | |
static dispatch_once_t onceToken; | |
dispatch_once(&onceToken, ^{ | |
if (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber_iOS_7_0) { | |
PSPDFAssertIfNotMainThread(); | |
// If your app is running in legacy mode, tintColor will be nil - else it must be set to some color. | |
if (UIApplication.sharedApplication.keyWindow) { | |
isUIKitFlatMode = [UIApplication.sharedApplication.delegate.window performSelector:@selector(tintColor)] != nil; |
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
do shell script "defaults -currentHost write ~/Library/Preferences/ByHost/com.apple.notificationcenterui doNotDisturb -boolean true" | |
set theDate to quoted form of (do shell script "date -u +\"%Y-%m-%d %H:%M:%S +0000\"") | |
do shell script "defaults -currentHost write ~/Library/Preferences/ByHost/com.apple.notificationcenterui doNotDisturbDate -date " & theDate | |
do shell script "killall NotificationCenter" |