Skip to content

Instantly share code, notes, and snippets.

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();
__block id foo = [self funcReturningHandle:^{
[weakSelf removeHandle:foo];
}]
//
// HarmonyDiscovery.swift
// XMPPFun
//
// Created by Joshua Weinberg on 4/25/15.
// Copyright (c) 2015 Joshua Weinberg. All rights reserved.
//
import Foundation
//
// HarmonyDiscovery.swift
// XMPPFun
//
// Created by Joshua Weinberg on 4/25/15.
// Copyright (c) 2015 Joshua Weinberg. All rights reserved.
//
import Foundation
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) }
//
// ConstraintTypes.swift
// ConstraintsTest
//
import UIKit
enum ConstraintDirection {
case Natural
case LTR
//
// ConstraintTypes.swift
// ConstraintsTest
//
// Created by Joshua Weinberg on 6/8/14.
// Copyright (c) 2014 Joshua Weinberg. All rights reserved.
//
import UIKit
//
// Constraints.swift
// ConstraintsTest
//
// Created by Joshua Weinberg on 6/6/14.
// Copyright (c) 2014 Joshua Weinberg. All rights reserved.
//
import UIKit
import UIKit
class TestView: UIView {
override func intrinsicContentSize() -> CGSize {
return CGSizeMake(100, 100)
}
}
class ViewController: UIViewController {
override func viewDidLoad() {
protocol Initializeable {
init()
}
extension Array: Initializeable {}
func create<T: Initializeable>(t: T.Type) -> T {
return t()
}