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
// | |
// IO.swift | |
// | |
// | |
// Created by Tommie N. Carter, Jr., MBA on 2/12/16. | |
// Copyright © 2016 MING Technology. All rights reserved. | |
// | |
// Based on work of: | |
// | |
// Swift.IO |
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
extension NSInputStream { | |
func read<T : Integer>() -> T? { | |
var buffer : T = 0 | |
let n = withUnsafePointer(&buffer) { (p) in | |
self.read(UnsafePointer<UInt8>(p), maxLength: sizeof(T)) | |
} | |
if n > 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
import Foundation | |
let bufferSize = 1024*1024 | |
enum Error: ErrorType { | |
case UnknownArgument(String) | |
case MissingValue(String) | |
case MissingPassword | |
case ShortWrite | |
case ReadError(NSError?) |
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
// | |
// JSON.swift | |
// Swerver | |
// | |
// Created by Julius Parishy on 12/12/15. | |
// Copyright © 2015 Julius Parishy. All rights reserved. | |
// | |
import Foundation |
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 | |
extension NSObject { | |
var isPublicClass: Bool { | |
return self.dynamicType.isPublicClass | |
} | |
class var isPublicClass: Bool { | |
return _PUBLIC_IOS_CLASSES.contains(NSStringFromClass(self)) | |
} |
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
// Given array of 2-tuples, return two arrays | |
func unzip<T, U>(array: [(T, U)]) -> ([T], [U]) { | |
var t = Array<T>() | |
var u = Array<U>() | |
for (a, b) in array { | |
t.append(a) | |
u.append(b) | |
} | |
return (t, u) | |
} |
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 Alamofire | |
public enum Router:URLRequestConvertible { | |
public static let baseUrlString:String = "http://testapi.example.com" | |
case Upload(fieldName: String, fileName: String, mimeType: String, fileContents: NSData, boundaryConstant:String); | |
var method: Alamofire.Method { | |
switch self { | |
case Upload: |
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
// | |
// OrdinalNumberFormatter.swift | |
// Tastify | |
// | |
// Created by Ian Grossberg on 10/1/15. | |
// Copyright © 2015 Noble Desktop. All rights reserved. | |
// | |
import Foundation |
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
extension String | |
{ | |
func writeTo(outputStream:NSOutputStream) | |
{ | |
if let data = self.dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false) | |
{ | |
let bytes = ConstUnsafePointer<UInt8>(data.bytes) | |
outputStream.write(bytes, maxLength: data.length) | |
} | |
} |
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
// MultiExporter.jsx | |
// Version 0.1 | |
// Version 0.2 Adds PNG and EPS exports | |
// Version 0.3 Adds support for exporting at different resolutions | |
// Version 0.4 Adds support for SVG, changed EPS behaviour to minimise output filesize | |
// Version 0.5 Fixed cropping issues | |
// Version 0.6 Added inner padding mode to prevent circular bounds clipping | |
// | |
// Copyright 2013 Tom Byrne | |
// Comments or suggestions to [email protected] |