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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>PayloadContent</key> | |
<array> | |
<dict> | |
<key>DNSSettings</key> | |
<dict> | |
<key>DNSProtocol</key> |
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
// MyURLStreamTask.swift | |
// Demonstrates using an NSURLSessionStreamTask to implement a bidirectional TCP socket connection | |
// | |
// by rhn@nicholson.com 2017-03-07 | |
// distribution: BSD 2-clause | |
// | |
import Foundation | |
class MyURLStreamTask { |
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 PlaygroundSupport | |
/// A thread-safe array. | |
public class SynchronizedArray<Element> { | |
private let queue = DispatchQueue(label: "io.zamzam.ZamzamKit.SynchronizedArray", attributes: .concurrent) | |
private var array = [Element]() | |
public init() { } | |
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 ChatCollectionViewFlowLayout: UICollectionViewFlowLayout { | |
private var topMostVisibleItem = Int.max | |
private var bottomMostVisibleItem = -Int.max | |
private var offset: CGFloat = 0.0 | |
private var visibleAttributes: [UICollectionViewLayoutAttributes]? |
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 | |
public struct IdentityAndTrust { | |
public var identityRef:SecIdentity | |
public var trust:SecTrust | |
public var certArray:NSArray | |
} | |
public func extractIdentity(certData:NSData, certPassword:String) -> IdentityAndTrust { | |
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
/** | |
* Basic Graph data structure implementation | |
* @constructor | |
*/ | |
var Graph = function() { | |
this.vertices = {}; | |
}; | |
Graph.prototype.add = function(name, edges) { | |
edges = edges || null; |
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 SystemConfiguration.CaptiveNetwork | |
func getWiFiSsid() -> String? { | |
var ssid: String? | |
if let interfaces = CNCopySupportedInterfaces() as NSArray? { | |
for interface in interfaces { | |
if let interfaceInfo = CNCopyCurrentNetworkInfo(interface as! CFString) as NSDictionary? { | |
ssid = interfaceInfo[kCNNetworkInfoKeySSID as String] as? String | |
break |
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
extension PHPhotoLibrary { | |
typealias PhotoAsset = PHAsset | |
typealias PhotoAlbum = PHAssetCollection | |
static func saveImage(image: UIImage, albumName: String, completion: (PHAsset?)->()) { | |
if let album = self.findAlbum(albumName) { | |
saveImage(image, album: album, completion: completion) | |
return | |
} |
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
// | |
// WatchSessionManager.swift | |
// WatchConnectivityDemo | |
// | |
// Created by Natasha Murashev on 9/3/15. | |
// Copyright © 2015 NatashaTheRobot. All rights reserved. | |
// | |
import WatchConnectivity |
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
private func example1() { | |
let queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0) | |
for i in 0..<10 { | |
dispatch_async(queue) { | |
NSLog("Start: \(i)") | |
sleep(3) | |
NSLog("End: \(i)") | |
} | |
} | |
} |
NewerOlder