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 noble = require('noble'); | |
var serviceUuids = ['6e400001b5a3f393e0a9e50e24dcca9e'] | |
var characteristicUuids = ['6e400002b5a3f393e0a9e50e24dcca9e'] | |
noble.on('stateChange', function(state) { | |
if (state === 'poweredOn') { | |
noble.startScanning(serviceUuids, false); | |
} else { | |
noble.stopScanning(); |
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
__block id foo = [self funcReturningHandle:^{ | |
[weakSelf removeHandle:foo]; | |
}] |
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
// | |
// HarmonyDiscovery.swift | |
// XMPPFun | |
// | |
// Created by Joshua Weinberg on 4/25/15. | |
// Copyright (c) 2015 Joshua Weinberg. 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
// | |
// HarmonyDiscovery.swift | |
// XMPPFun | |
// | |
// Created by Joshua Weinberg on 4/25/15. | |
// Copyright (c) 2015 Joshua Weinberg. 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
struct ReinterpretSequence<T, U> : Swift.Collection | |
{ | |
typealias IndexType = Int | |
typealias GeneratorType = IndexingGenerator<ReinterpretSequence<T,U>> | |
let value: T | |
var startIndex: IndexType { return 0 } | |
var endIndex: IndexType { return sizeof(T) / sizeof(U) } |
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
// | |
// ConstraintTypes.swift | |
// ConstraintsTest | |
// | |
import UIKit | |
enum ConstraintDirection { | |
case Natural | |
case LTR |
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
// | |
// ConstraintTypes.swift | |
// ConstraintsTest | |
// | |
// Created by Joshua Weinberg on 6/8/14. | |
// Copyright (c) 2014 Joshua Weinberg. All rights reserved. | |
// | |
import UIKit |
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
// | |
// Constraints.swift | |
// ConstraintsTest | |
// | |
// Created by Joshua Weinberg on 6/6/14. | |
// Copyright (c) 2014 Joshua Weinberg. All rights reserved. | |
// | |
import UIKit |
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 | |
class TestView: UIView { | |
override func intrinsicContentSize() -> CGSize { | |
return CGSizeMake(100, 100) | |
} | |
} | |
class ViewController: UIViewController { | |
override func viewDidLoad() { |
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 Initializeable { | |
init() | |
} | |
extension Array: Initializeable {} | |
func create<T: Initializeable>(t: T.Type) -> T { | |
return t() | |
} |
NewerOlder