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
#include <stdio.h> | |
#include <stdlib.h> | |
typedef struct _Object{ | |
const char *objectClass; | |
int objectId; | |
int (^isEqualToObject) (void *other); | |
} Object; | |
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
Person.h (Person) | |
@interface Person : NSObject | |
@property (copy) NSString *givenName; | |
@property (copy) NSString *surname; | |
@end | |
Person.m (Person) | |
@interface Person () | |
@property (strong) NSMutableDictionary *properties; | |
@end |
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
// BlockInvocation.h | |
#import <Cocoa/Cocoa.h> | |
@interface BlockInvocation : NSObject { | |
void *block; | |
} | |
-(id)initWithBlock:(void *)aBlock; |
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
// | |
// AsynchronousOperation.swift | |
// Primer | |
// | |
// Created by Alex Usbergo on 18/10/15. | |
// Copyright © 2015 Alex Usbergo. All rights reserved. | |
// | |
import Foundation |
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 | |
//1.1 | |
extension String { | |
///Implement an algorithm to determine if a string has all unique characters. | |
///What if you cannot use additional data structures | |
public func hasUniqueCharacter(useAdditionalDataStructures: Bool = true) -> Bool { | |
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 | |
//9.1 | |
public func memoize<T:Hashable,U>(body: (T->U, T)->U) -> T->U { | |
var memo = [T : U]() | |
var result: (T->U)! | |
result = { x in | |
if let q = memo[x] { return q } |
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 | |
//17.2 | |
public enum TicTacToe { case X, O, Empty } | |
var matrix = Matrix<TicTacToe>(rows: 3, columns: 3, repeatedValue: TicTacToe.Empty) | |
var m1 = matrix | |
m1[0,0] = TicTacToe.X | |
m1[1,1] = TicTacToe.X |
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 AnyStateful: class { | |
/// The children of this node. | |
var statefulChildren: [AnyStateful] { get } | |
// Internal call to propagate the render call. | |
func _render(state: Any?) | |
/// The controller that is used as delegate for this stateful object. | |
weak var _controller: StatefulControllerType? { get set } |
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 | |
import DispatchStore | |
import Firebase | |
import FirebaseDatabase | |
import Wrap | |
import Unbox | |
// MARK: - Firebase specific logic |
OlderNewer