This file contains hidden or 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 CoreBluetooth | |
import UIKit | |
class ViewController: UIViewController, CBCentralManagerDelegate, CBPeripheralDelegate { | |
var centralManager: CBCentralManager! | |
var peripheral: CBPeripheral! | |
var currentCharacteristic: CBCharacteristic! = nil | |
var readRSSITimer: NSTimer! | |
var RSSIholder: NSNumber = 0 |
This file contains hidden or 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
// | |
// Storage.swift | |
// | |
// Created by Grigory Avdyushin on 30.06.16. | |
// Copyright © 2016 Grigory Avdyushin. All rights reserved. | |
// | |
import UIKit | |
import CoreData |
This file contains hidden or 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
// | |
// NSStackView+Animations.swift | |
// | |
// Created by Martin Höller on 18.06.16. | |
// Copyright © 2016 blue banana software. All rights reserved. | |
// | |
// Based on http://prod.lists.apple.com/archives/cocoa-dev/2015/Jan/msg00314.html | |
import Cocoa |
This file contains hidden or 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 SearchResultsViewController: UITableViewController { | |
// MARK: - Properties | |
private let viewModel: SearchResultsViewModelType | |
private let disposeBag = DisposeBag() | |
// MARK: - Initialization | |
init(viewModel: SearchResultsViewModelType = SearchResultsViewModel()) { |
This file contains hidden or 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
// | |
// NSManagedObject+Clone.h | |
// TResActivityLog | |
// | |
// Created by Pierre Houston on 2016-05-30. | |
// Copyright © 2016 Resilience software. All rights reserved. | |
// | |
// When no context provided, uses [NSManagedObjectContext MR_defaultContext]. | |
// Note, I was going to add unique prefix "jph_" to these category method names, | |
// but currently I've left those out. |
This file contains hidden or 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 CoreData | |
extension NSFetchRequest { | |
func withPredicate(format: String, arguments: [AnyObject]? = nil) -> NSFetchRequest { | |
return withPredicate(NSPredicate(format: format, argumentArray: arguments)) | |
} | |
func andPredicate(format: String, arguments: [AnyObject]? = nil) -> NSFetchRequest { |
This file contains hidden or 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 re | |
from collections import namedtuple | |
ASCII_BYTE = " !\"#\$%&\'\(\)\*\+,-\./0123456789:;<=>\?@ABCDEFGHIJKLMNOPQRSTUVWXYZ\[\]\^_`abcdefghijklmnopqrstuvwxyz\{\|\}\\\~\t" | |
String = namedtuple("String", ["s", "offset"]) | |
This file contains hidden or 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 | |
public protocol Observer: Equatable { | |
associatedtype EventType | |
func listen(_ event: EventType) | |
} | |
public protocol Observable { | |
associatedtype ObserverType: Observer | |
associatedtype EventType |
This file contains hidden or 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 Cocoa | |
@objc | |
class SomeTextStorage: NSTextStorage { | |
private var storage: NSMutableAttributedString | |
override init() { | |
storage = NSMutableAttributedString(string: "", attributes: nil) | |
super.init() |
This file contains hidden or 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 XCPlayground | |
XCPlaygroundPage.currentPage.needsIndefiniteExecution = true | |
extension NSData { | |
func castToCPointer<T>() -> T { | |
let mem = UnsafeMutablePointer<T>.alloc(sizeof(T.Type)) | |
self.getBytes(mem, length: sizeof(T.Type)) | |
return mem.move() |