Skip to content

Instantly share code, notes, and snippets.

View lukewar's full-sized avatar

Lukasz Warchol lukewar

View GitHub Profile
@lukewar
lukewar / gist:80c44c7e440bd6458786
Created December 11, 2014 16:34
Inset free table view separator
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
if ([tableView respondsToSelector:@selector(setSeparatorInset:)]) {
[tableView setSeparatorInset:UIEdgeInsetsZero];
}
if ([tableView respondsToSelector:@selector(setLayoutMargins:)]) {
[tableView setLayoutMargins:UIEdgeInsetsZero];
}
if ([cell respondsToSelector:@selector(setLayoutMargins:)]) {
[cell setLayoutMargins:UIEdgeInsetsZero];
@lukewar
lukewar / block asynchronous
Last active August 29, 2015 14:10
Blocking asynchronous operation.
NSBlockOperation *operation = [NSBlockOperation blockOperationWithBlock:^{
dispatch_group_t dispatchGroup = dispatch_group_create();
dispatch_group_enter(dispatchGroup);
[task runWithCompletion:^{
dispatch_group_leave(dispatchGroup);
}];
dispatch_group_wait(dispatchGroup, DISPATCH_TIME_FOREVER);
}];
@lukewar
lukewar / xcode-test
Created July 5, 2014 09:29
Running specs from command line.
xcodebuild test -workspace <>.xcworkspace -scheme <> -destination "platform=iOS Simulator,name=iPhone Retina (4-inch),OS=7.1