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
func migrate(noteManager : NoteManager) { | |
if let coreDataNotes = GNNote.MR_findAll() { | |
for case let note as GNNote in coreDataNotes { | |
if let bundleID = note.appBundleID, docPath = note.documentPath, content = note.content where !content.string.isEmpty { | |
noteManager.createNote(bundleID, docID: docPath, content: content) | |
} | |
} | |
} | |
} |
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 Window { | |
let element: AXUIElementRef | |
init?(processID: pid_t) { | |
element = AXUIElementCreateApplication(processID).takeRetainedValue() | |
} | |
var processID: pid_t { | |
let pid : pid_t |
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 ObjectMapper | |
class News : Mappable { | |
let id: Int | |
let username : String | |
let date: String | |
let share_url: String | |
let image: String | |
let title: String |
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
override func viewDidAppear(animated: Bool) { | |
super.viewDidAppear(animated) | |
if self.alreadySearched { | |
return | |
} | |
self.alreadySearched = true | |
self.searchingAnimationView.showMessage2("LOOKING FOR HOTELS\nWITH VACANCIES") { | |
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
var queryResult = self.database.executeQuery(select(star, person)) | |
XCTAssertTrue(queryResult.isSuccess) | |
queryResult.consume { resultSet in | |
var name = result.name | |
... | |
} |
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 func memoize<T: Hashable, U>(f: (T) -> U) -> (T) -> U { | |
var memo : [T : U] = [:] | |
return { x in | |
if let q = memo[x] { | |
return q | |
} | |
let r = f(x) | |
memo[x] = r | |
return r | |
} |
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/Foundation.h> | |
int main(int argc, const char * argv[]) | |
{ | |
@autoreleasepool { | |
int number = 0; | |
int round = 1; | |
NSMutableArray *array = [NSMutableArray array]; |
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
... All of foundation's headers ... | |
@interface MyQuiz : NSObject | |
@property (nonatomic, strong) NSMutableArray *quoteArray; | |
-(id) initWithTheQuiz : (NSString *) plistName; | |
@end | |
@implementation MyQuiz | |
-(id) initWithTheQuiz:(NSString *)plistName { | |
self = [super init]; | |
if(self) { |
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
/* | |
Example.m | |
Created by Remy "Psy" Demarest on 21/04/2012. | |
Copyright (c) 2012. Remy "Psy" Demarest | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
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 *playerIds = [[NSMutableArray alloc] init]; | |
for (GKTurnBasedMatch *match in theMatches) | |
{ | |
[playerIds addObjectsFromArray:[match playerIdentifiers]]; | |
} | |
[playerIds addObjectsFromArray:friends]; |
NewerOlder