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
BOOL isDarkImage(UIImage* inputImage){ | |
BOOL isDark = FALSE; | |
CFDataRef imageData = CGDataProviderCopyData(CGImageGetDataProvider(inputImage.CGImage)); | |
const UInt8 *pixels = CFDataGetBytePtr(imageData); | |
int darkPixels = 0; | |
int length = CFDataGetLength(imageData); |
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
public struct CoreDataContextObserverState : OptionSetType { | |
static public let Inserted: ContextWatcher.CoreDataContextObserverState | |
static public let Updated: ContextWatcher.CoreDataContextObserverState | |
static public let Deleted: ContextWatcher.CoreDataContextObserverState | |
static public let Refreshed: ContextWatcher.CoreDataContextObserverState | |
static public let All: CoreDataContextObserverState | |
} | |
public typealias CoreDataContextObserverCompletionBlock = (NSManagedObject, CoreDataContextObserverState) -> () | |
public class CoreDataContextObserver { |
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
class var userDateFormatter : NSDateFormatter { | |
struct Static { | |
static let instance: NSDateFormatter = { | |
let dateFormatter = NSDateFormatter() | |
dateFormatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'" | |
return dateFormatter | |
}() | |
} | |
return Static.instance | |
} |
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
#!/bin/sh | |
if [ "$#" != 3 ]; then | |
echo "Illegal number of parameters, usage: ./make_cert.sh apn_file key_file output_filename" | |
fi | |
eval "openssl x509 -in $1.cer -inform DER -out $1.pem -outform PEM" | |
eval "openssl pkcs12 -nodes -export -inkey $2.key -in $1.pem -out $1.p12" | |
eval "openssl pkcs12 -nodes -nocerts -out $2.pem -in $1.p12" | |
eval "cat $1.pem $2.pem > $3.pem" |
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
// http://stackoverflow.com/questions/17535918/aes-gets-different-results-in-ios-and-java | |
- (NSData *)AES256EncryptWithKey:(NSString *)key { | |
// 'key' should be 32 bytes for AES256, will be null-padded otherwise | |
char keyPtr[kCCKeySizeAES256+1]; // room for terminator (unused) | |
bzero(keyPtr, sizeof(keyPtr)); // fill with zeroes (for padding) | |
// fetch key data | |
[key getCString:keyPtr maxLength:sizeof(keyPtr) encoding:NSUTF8StringEncoding]; | |
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
// | |
// CoreDataContextWatcher.swift | |
// ContextWatcher | |
// | |
// Created by Michal Zaborowski on 10.05.2016. | |
// Copyright © 2016 Inspace Labs Sp z o. o. Spółka Komandytowa. All rights reserved. | |
// | |
import Foundation | |
import CoreData |