Skip to content

Instantly share code, notes, and snippets.

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)
}
}
}
}
@beelsebob
beelsebob / Window.swift
Last active September 19, 2015 20:05 — forked from freysie/Window.swift
class Window {
let element: AXUIElementRef
init?(processID: pid_t) {
element = AXUIElementCreateApplication(processID).takeRetainedValue()
}
var processID: pid_t {
let pid : pid_t
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
override func viewDidAppear(animated: Bool) {
super.viewDidAppear(animated)
if self.alreadySearched {
return
}
self.alreadySearched = true
self.searchingAnimationView.showMessage2("LOOKING FOR HOTELS\nWITH VACANCIES") {
var queryResult = self.database.executeQuery(select(star, person))
XCTAssertTrue(queryResult.isSuccess)
queryResult.consume { resultSet in
var name = result.name
...
}
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
}
#import <Foundation/Foundation.h>
int main(int argc, const char * argv[])
{
@autoreleasepool {
int number = 0;
int round = 1;
NSMutableArray *array = [NSMutableArray array];
@beelsebob
beelsebob / MyQuiz.m
Last active December 21, 2015 06:19 — forked from pbrewczynski/MyQuiz.h
... 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) {
/*
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
@beelsebob
beelsebob / gist:6201641
Last active December 20, 2015 21:59 — forked from seivan/gist:6201583
NSMutableArray *playerIds = [[NSMutableArray alloc] init];
for (GKTurnBasedMatch *match in theMatches)
{
[playerIds addObjectsFromArray:[match playerIdentifiers]];
}
[playerIds addObjectsFromArray:friends];