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
| + (NSString *)fileTypeForData:(NSData *)data | |
| { | |
| /* | |
| http://www.garykessler.net/library/file_sigs.html | |
| 1F 8B 08 .‹. | |
| GZ, TGZ GZIP archive file | |
| 50 4B 03 04 PK.. | |
| ZIP PKZIP archive file (Ref. 1 | Ref. 2) |
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
| private var stringPropertyAssociationKey: UInt8 = 0 | |
| private var intPropertyAssociationKey: UInt8 = 0 | |
| // This is a replacement for a custom UICollectionViewLayoutAttributes subclass since | |
| // layoutAttributesForElementsInRect() is crashing when a subclass is registered. | |
| // https://devforums.apple.com/message/1120429#1120429 | |
| // | |
| // http://stackoverflow.com/questions/25426780/swift-extension-stored-properties-alternative#answer-25428013 | |
| // http://stackoverflow.com/questions/24133058/is-there-a-way-to-set-associated-objects-in-swift#answer-25428409 | |
| extension UICollectionViewLayoutAttributes { |
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
| #pragma mark - App Singleton | |
| - (instancetype)init { | |
| ... | |
| [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(userDefaultsDidChange:) name:NSUserDefaultsDidChangeNotification object:nil]; | |
| ... | |
| } | |
| - (void)dealloc { | |
| [[NSNotificationCenter defaultCenter] removeObserver:self]; |
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
| NSBundle *bundle = [NSBundle mainBundle]; | |
| if ([[bundle.bundleURL pathExtension] isEqualToString:@"appex"]) { | |
| // Peel off two directory levels - MY_APP.app/PlugIns/MY_APP_EXTENSION.appex | |
| bundle = [NSBundle bundleWithURL:[[bundle.bundleURL URLByDeletingLastPathComponent] URLByDeletingLastPathComponent]]; | |
| } | |
| NSURL *url = [bundle URLForResource:... withExtension:...]; |
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 <git2/common.h> | |
| NSString *const CACertificateFile_DigiCert = @"DigiCert High Assurance EV Root CA.pem"; | |
| NSString *const certFilePath = [[NSBundle mainBundle].bundlePath stringByAppendingPathComponent:CACertificateFile_DigiCert]; | |
| NSLog(@"Loading certificate: %@", certFilePath); | |
| const char *file = certFilePath.UTF8String; | |
| const char *path = NULL; | |
| int returnValue = git_libgit2_opts(GIT_OPT_SET_SSL_CERT_LOCATIONS, file, path); |
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
| <?xml version="1.0" encoding="UTF-8"?> | |
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
| <plist version="1.0"> | |
| <dict> | |
| <key>Fabric</key> | |
| <dict> | |
| <key>APIKey</key> | |
| <string>xxxxxxxxxxxx</string> | |
| <key>Kits</key> | |
| <array> |
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
| size_t size; | |
| sysctlbyname("hw.machine", NULL, &size, NULL, 0); | |
| char *machine = calloc(1, size); | |
| if (machine) { | |
| sysctlbyname("hw.machine", machine, &size, NULL, 0); | |
| NSLog(@"modelIdentifier: %@", @(machine)); | |
| free(machine); | |
| } |
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
| Pod::Spec.new do |s| | |
| s.name = 'POD_NAME' | |
| s.version = '1.0.0' | |
| s.license = { :type => 'MIT', :file => 'LICENSE' } | |
| s.summary = 'Example of pod which installs a run script into the Xcode project (first target)' | |
| s.homepage = 'https://github.com/phatblat/POD_NAME' | |
| s.authors = { 'Ben Chatelain' => 'benchatelain@gmail.com' } | |
| s.source = { :git => 'https://github.com/phatblat/POD_NAME.git', :tag => s.version.to_s } | |
| s.ios.deployment_target = '6.0' |
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
| tmpdir=/tmp/phatblat-images | |
| subdir=images/ | |
| remote_git=git://github.com/phatblat/phatblat.github.io.git | |
| remote_https=https://github.com/phatblat/phatblat.github.io.git | |
| mkdir $tmpdir | |
| cd $tmpdir | |
| git init | |
| git remote add -f origin $remote_git || \ | |
| git remote set-url origin $remote_https && \ |
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/env ruby | |
| # crashlytics.rb | |
| # | |
| # Created by Ben Chatelain on 5/13/14. | |
| # Alternate values make much of this script testable from outside Xcode | |
| if ARGV.length > 0 | |
| args = ARGV.join(" ") | |
| else |