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 main(int argc, char *argv[]) | |
{ | |
#ifdef DEBUG | |
// will make debugging more easy | |
@try { | |
@autoreleasepool { | |
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); | |
} | |
} | |
@catch (NSException *exception) { |
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
NSMutableArray* ma = [[NSMutableArray alloc] init]; | |
// about 0.015 seconds | |
for (int i = 0; i<10000; i++) { | |
[ma addObject:[NSString stringWithFormat:@"%@ %d", @"ABC", i]]; | |
} | |
// still slow: takes more than 7 seconds..... | |
__block NSMutableArray* ma2 = [ma mutableCopy]; | |
[ma enumerateObjectsWithOptions:NSEnumerationReverse usingBlock:^(id obj, NSUInteger idx, BOOL *stop) { | |
[ma2 removeObject:obj]; |
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
// create an auth manager object | |
AGAuthenticationManager* authMgr = [AGAuthenticationManager manager]; | |
// add a new auth module and the required 'base url': | |
NSURL* baseURL = [NSURL URLWithString:@"https://todoauth-aerogear.rhcloud.com/todo-server"]; | |
id<AGAuthenticationModule> myMod = [authMgr add:@"authMod" baseURL:baseURL]; | |
// ==================================== |
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
// attention: needs when.js, jquery and checks only for webkit | |
var transformTo = function ($e, css, property) { | |
var deferred = when.defer(); | |
$e.on('webkitTransitionEnd', function (e) { | |
if (!!property && property !== e.originalEvent.propertyName) { | |
return; | |
} | |
$e.off('webkitTransitionEnd'); | |
deferred.resolve(); |
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
// Current state of curry and partial application in Swift | |
// go | |
func adder1(a:Int)(b:Int) -> Int { | |
return a + b | |
} | |
let adder2 = {(a: Int, b: Int) -> Int in | |
return a + b; | |
} |
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
Process: SourceKitService [41303] | |
Path: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/sourcekitd.framework/Versions/A/XPCServices/SourceKitService.xpc/Contents/MacOS/SourceKitService | |
Identifier: SourceKitService | |
Version: 1.0 (700.1.101.6) | |
Code Type: X86-64 (Native) | |
Parent Process: ??? [1] | |
Responsible: Xcode [24966] | |
User ID: 502 | |
Date/Time: 2015-11-19 15:16:41.268 +0100 |
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 | |
#if os(iOS) | |
import UIKit | |
#endif | |
#if os(watchOS) | |
import WatchKit | |
#endif | |
extension NSMutableAttributedString { |
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
/// the protocol | |
protocol ImplicitDefault { | |
static var implicitDefault: Self { get } | |
} | |
/// the implementation for Strings | |
extension String: ImplicitDefault { | |
/// i dont care i take the empty string as default |
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
// ---------------------------------------------------------------------------------------------------- | |
// ArrayZipper Comonads in Swift | |
// | |
// http://elm4ward.github.io/swift/functional/comonad/2016/03/30/monads-comonads.html | |
// | |
// 1. Array extensions | |
// 2. ArrayZipperError | |
// 3. ArrayZipper | |
// 4. ArrayZipper extensions | |
// 5. custom operators |
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
// ---------------------------------------------------------------------------------------------------- | |
// Protocol Flow in Swift | |
// | |
// http://elm4ward.github.io/swift/protocols/2016/04/02/protocollisions.html | |
// | |
// 1. The Protocols | |
// 2. The Flow | |
// 3. String Example | |
// 4. Custom Example | |
// ---------------------------------------------------------------------------------------------------- |
OlderNewer