Skip to content

Instantly share code, notes, and snippets.

@CognitiveDisson
CognitiveDisson / ConcurrentPerformer.swift
Created February 12, 2019 13:39
ConcurrentPerformer
import Foundation
final class ConcurrentPerformer {
func perform<T>(_ objects: [T], iterations: Int? = nil, action: ((T) -> ())) {
if let iterations = iterations {
customPerform(objects, iterations: iterations, action: action)
} else {
defaultPerform(objects, action: action)
}
@CognitiveDisson
CognitiveDisson / TimeProfiler.swift
Last active February 17, 2019 13:23
TimeProfiler
import Foundation
final class TimeProfiler {
typealias TimeMeasurementTimestamp = TimeInterval
public typealias TimeMeasurementDescription = String
public static func measure<R>(
description: TimeMeasurementDescription,
action: (() throws -> (R)))
@CognitiveDisson
CognitiveDisson / obfuscatedKey
Last active September 14, 2016 15:30 — forked from DevAlloy/uuidForToken
Алгоритм генерации строки, которую хотим спрятать
- (NSString*)hexStringFromString:(NSString*)string
{
const char *utf8 = [string UTF8String];
NSMutableString *result = [NSMutableString new];
for (int i = 0; i < string.length; i++) {
[result appendFormat:@"0x%02X, ", *utf8++ & 0x00FF];
}
return result;
}
//
// AppDelegateHandler.swift
// Pods
//
// Created by Andrey Zarembo on 10.02.16.
//
//
import Foundation