Skip to content

Instantly share code, notes, and snippets.

View tomassliz's full-sized avatar

Tomáš Slíž tomassliz

View GitHub Profile
@tomassliz
tomassliz / viewController.m
Last active August 29, 2015 13:57
BOOL value behaviour with high optimization level
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
BOOL isMember = NO; // here must be variable set to no, otherwise is initialized to thrash
for (NSIndexPath *ip in self.expandedCells) {
if ([ip isEqualToIndexPath:indexPath]) {
isMember = YES;
break;
}
}
@tomassliz
tomassliz / gist:a4630898ccce52e97e2c
Created May 8, 2015 18:26
ExampleApp Build Log
CompileSwift normal x86_64 /Users/deny/Desktop/ExampleApp/ExampleApp/ViewController.swift
cd /Users/deny/Desktop/ExampleApp
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c -primary-file /Users/deny/Desktop/ExampleApp/ExampleApp/ViewController.swift /Users/deny/Desktop/ExampleApp/ExampleApp/AppDelegate.swift -target x86_64-apple-ios8.3 -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.3.sdk -I /Users/deny/Library/Developer/Xcode/DerivedData/ExampleApp-goerkbjmunjsnkcerylpquuuwibk/Build/Products/Debug-iphonesimulator -F /Users/deny/Library/Developer/Xcode/DerivedData/ExampleApp-goerkbjmunjsnkcerylpquuuwibk/Build/Products/Debug-iphonesimulator -g -module-cache-path /Users/deny/Library/Developer/Xcode/DerivedData/ModuleCache -serialize-debugging-options -Xcc -I/Users/deny/Library/Developer/Xcode/DerivedData/ExampleApp-goerkbjmunjsnkcerylpquuuwibk/Build/Intermediat
@tomassliz
tomassliz / Objective-C tricks
Last active December 24, 2015 05:49
Better singleton shared instance creation with use of GCD in Objective-C.
+ (instancetype)sharedInstance {
static TSClass *sharedInstance = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
sharedInstance = [[self alloc] init];
});
return sharedInstance;
}
@tomassliz
tomassliz / number_of_lines.sh
Last active January 2, 2016 23:09
Terminal command for showing Objective-C implementation files sorted by number of lines.
find . -name "*.m" -exec wc -l "{}" \; | sort -n

Keybase proof

I hereby claim:

  • I am tomassliz on github.
  • I am tomassliz (https://keybase.io/tomassliz) on keybase.
  • I have a public key ASCT7g3K-mjV0jwLfN60NxsyktG8AjbO9T3eE8egoBf9rQo

To claim this, I am signing this object:

@tomassliz
tomassliz / TestFlightHelper.swift
Created February 8, 2019 21:03
Check if the app is installed from TestFlight
// Should be working for free apps too
func isTestFlight() -> Bool {
guard let appStoreReceiptURL = Bundle.main.appStoreReceiptURL else {
return false
}
return appStoreReceiptURL.lastPathComponent == "sandboxReceipt"
}