Skip to content

Instantly share code, notes, and snippets.

View mkuliszkiewicz's full-sized avatar
🚴

Maciej Kuliszkiewicz mkuliszkiewicz

🚴
  • Kraków / Stockholm
View GitHub Profile
static BOOL isRunningTests(void) {
NSDictionary *environment = [[NSProcessInfo processInfo] environment];
NSString *injectBundle = environment[@"XCInjectBundle"];
return [[injectBundle pathExtension] isEqualToString:@"octest"];
}
@mkuliszkiewicz
mkuliszkiewicz / loc_stats.sh
Created October 31, 2014 09:00
LOC project statistics
find . -name "*.m" -exec wc -l "{}" \; | sort -n
@mkuliszkiewicz
mkuliszkiewicz / UIView+GetColor.swift
Last active May 28, 2023 13:22
UIView extension which allows to get colour of any point inside
//
// UIView+GetColor.swift
// SwiftPick
//
// Created by Maciej Banasiewicz, Michał Apanowicz on 06/07/14.
//
//
import UIKit
@mkuliszkiewicz
mkuliszkiewicz / NSString+URLHelper.h
Created September 18, 2013 15:21
Utility to get url from a string.
#import <Foundation/Foundation.h>
@interface NSString (URLHelper)
- (NSURL *)urlFromString;
@end
// This goes in some global header, let it be *.pch
#define SuppressPerformSelectorLeakWarning(Stuff) \
do { \
_Pragma("clang diagnostic push") \
_Pragma("clang diagnostic ignored \"-Warc-performSelector-leaks\"") \
Stuff; \
_Pragma("clang diagnostic pop") \
} while (0)
// And then in any method you just call this function
//
// NSObject+LogProperties.h
//
// Gist created by Maciej Banasiewicz.
// Log all properties of an object.
// Credits: Tieme
// Source: http://stackoverflow.com/questions/13922581/is-there-a-way-to-log-all-the-property-values-of-an-objective-c-instance
#import <Foundation/Foundation.h>
@mkuliszkiewicz
mkuliszkiewicz / UITableView+EnumarateCells.h
Last active December 19, 2015 12:49
Enumerate table view cells using blocks
//
// UITableView+HLTEnumarateCells.h
//
// Created by Maciej Banasiewicz.
//
#import <UIKit/UIKit.h>
@interface UITableView (HLTEnumarateCells)
- (void)enumarateTableViewCellsUsingBlock:(void(^)(UITableViewCell *))blk;