This file contains 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
- (NSArray*) quickSortArray:(NSArray*) arr { | |
if(arr.count <2) { | |
return arr; | |
} | |
NSMutableArray *mutableArr = [arr mutableCopy]; | |
NSMutableArray *leftArray = [[NSMutableArray alloc] init]; | |
NSMutableArray *rightArray = [[NSMutableArray alloc] init]; |
This file contains 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
- (NSArray*) mergeSortArray:(NSArray*) arr { | |
if(arr.count <2) { | |
return arr; | |
} | |
NSUInteger middle = arr.count/2; | |
NSRange leftRange = {0,middle}; | |
NSArray *leftArray = [arr subarrayWithRange:leftRange]; | |
NSRange rightRange = {middle,arr.count-middle}; | |
NSArray *rightArray = [arr subarrayWithRange:rightRange]; |
This file contains 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
- (id) sharedInstance { | |
static MyObject *sharedInstance = nil; | |
static dispatch_once_t onceToken; | |
dispatch_once(&onceToken, ^{ | |
sharedInstance = [[MyObject alloc] init]; | |
}); | |
return sharedInstance; | |
} |
This file contains 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
- (int) atoi:(char *) str { | |
if(!str) | |
NSLog(@"Enter valid string"); | |
int result = 0; | |
char *p = str; | |
while((*p>='0') && (*p<='9')) { | |
result = result*10 + (*p - '0'); | |
p++; | |
} |
This file contains 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 *) reverseString:(NSString *)str { | |
NSMutableString *reverseString = [[NSMutableString alloc] initWithCapacity:str.length]; | |
for(int i=str.length -1;i>=0;i--) { | |
[reverseString appendString:[NSString stringWithFormat:@"%c", [str characterAtIndex:i]]]; | |
} | |
return reverseString; | |
} |
This file contains 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
// | |
// Stack.h | |
// testing | |
// | |
// Created by Roman Barzyczak on 16.02.2014. | |
// | |
// | |
#import <Foundation/Foundation.h> |
This file contains 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
mkdir MyIcon | |
sips -z 29 29 Icon1024.png --out MyIcon/icon_29x29.png | |
sips -z 58 58 Icon1024.png --out MyIcon/icon_29x29@2x.png | |
sips -z 87 87 Icon1024.png --out MyIcon/icon_29x29@3x.png | |
sips -z 40 40 Icon1024.png --out MyIcon/icon_40x40.png | |
sips -z 80 80 Icon1024.png --out MyIcon/icon_40x40@2x.png | |
sips -z 120 120 Icon1024.png --out MyIcon/icon_40x40@3x.png | |
sips -z 50 50 Icon1024.png --out MyIcon/icon_50x50.png |
This file contains 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
// | |
// AlertControllerFabric.swift | |
// Mapa Turystyczna | |
// | |
// Created by Roman Barzyczak on 05.04.2016. | |
// | |
import Foundation | |
class AlertHelper { |
This file contains 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 Foundation | |
extension Dictionary { | |
static func contentsOf(url: URL) -> Dictionary<Key, Value>? { | |
do { | |
let data = try Data(contentsOf:url) | |
let properties = try PropertyListSerialization.propertyList(from: data, options: [], format: nil) as? [Key: Value] | |
return properties | |
} catch { | |
return nil | |
} |
This file contains 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 UIKit | |
final class Action: NSObject { | |
private let _action: () -> () | |
init(action: @escaping () -> ()) { | |
_action = action | |
super.init() | |
} | |
func action() { | |
_action() |
OlderNewer