Skip to content

Instantly share code, notes, and snippets.

View mkuliszkiewicz's full-sized avatar
👋

Maciej Kuliszkiewicz mkuliszkiewicz

👋
View GitHub Profile
@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;
//
// 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>
// 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
@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
@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 / loc_stats.sh
Created October 31, 2014 09:00
LOC project statistics
find . -name "*.m" -exec wc -l "{}" \; | sort -n
static BOOL isRunningTests(void) {
NSDictionary *environment = [[NSProcessInfo processInfo] environment];
NSString *injectBundle = environment[@"XCInjectBundle"];
return [[injectBundle pathExtension] isEqualToString:@"octest"];
}
/// Observes a run loop to detect any stalling or blocking that occurs.
///
/// This class is thread-safe.
@interface GHRunLoopWatchdog : NSObject
/// Initializes the receiver to watch the specified run loop, using a default
/// stalling threshold.
- (id)initWithRunLoop:(CFRunLoopRef)runLoop;
/// Initializes the receiver to detect when the specified run loop blocks for
require 'plist'
# xcode 6.2 A16FF353-8441-459E-A50C-B071F53F51B7
plugins_path = File.expand_path('~') + "/Library/Application\ Support/Developer/Shared/Xcode/Plug-ins/"
Dir.foreach(plugins_path) do |fname|
if fname != '.' && fname != '..' && fname != '.DS_Store'
plist_path = plugins_path + fname.to_s + '/Contents/Info.plist'
if File.exist?(plist_path)
application_plist = Plist::parse_xml(plist_path)
current_uuids = application_plist['DVTPlugInCompatibilityUUIDs']
# This is not a ready-to-run script. It just shows the relevant command-line calls.
XC_WORKSPACE=path/to/MyApp.xcworkspace
XC_SCHEME=MyApp
XC_CONFIG=Release
ARCHIVE_PATH=dest/path/to/MyApp.xcarchive
EXPORT_PATH=dest/path/to/MyApp.ipa
DIST_PROFILE=NameOfDistributionProfile
# Build and archive. This can be done by regular developers, using their developer key/profile.