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
//: Playground - noun: a place where people can play | |
import UIKit | |
import XCPlayground | |
class VC: UIViewController { | |
let newView = UIView() | |
override func viewDidAppear(animated: Bool) { | |
super.viewDidAppear(animated) |
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
/Library/Developer/Toolchains/swift-2.2-SNAPSHOT-2015-12-01-a.xctoolchain/usr/bin/swiftc -module-name SimpleGetClient -incremental -emit-dependencies -emit-module -emit-module-path /Users/aciid/mycode/swift/GetClient/SwiftGetClientDemo/.build/debug/SimpleGetClient.swiftmodule -output-file-map /Users/aciid/mycode/swift/GetClient/SwiftGetClientDemo/.build/debug/SimpleGetClient.o/SimpleGetClient/output-file-map.json -parse-as-library -c /Users/aciid/mycode/swift/GetClient/SwiftGetClientDemo/Packages/SimpleGetClient-1.0.0/Sources/GetClient.swift -I /Users/aciid/mycode/swift/GetClient/SwiftGetClientDemo/.build/debug -j8 -Onone -g -target x86_64-apple-macosx10.10 -enable-testing -sdk /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -I /usr/local/include | |
/bin/sh -c "rm -f '/Users/aciid/mycode/swift/GetClient/SwiftGetClientDemo/.build/debug/SimpleGetClient.a'; ar cr '/Users/aciid/mycode/swift/GetClient/SwiftGetClientDemo/.build/debug/SimpleGetClient.a' '/Users/a |
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
prefix func ++(inout x: Int) -> Int { | |
x = x + 1 | |
return x | |
} | |
postfix func ++(inout x: Int) -> Int { | |
let oldX = x | |
x = x + 1 | |
return oldX | |
} |
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
let ib = hoedown_buffer_new(1024); | |
hoedown_buffer_puts(ib, "#file\n##dsdsd\n`hello`"); | |
let renderer = hoedown_html_renderer_new(hoedown_html_flags(0), 0); | |
let ob = hoedown_buffer_new(1024); | |
let document = hoedown_document_new(renderer, hoedown_extensions(0), 16); | |
hoedown_document_render(document, ob, ib.memory.data, ib.memory.size); | |
let outputData = ob.memory.data | |
let outputSize = ob.memory.size | |
let str = String.fromCString(UnsafePointer<CChar>(outputData))! |
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
if let userLibPaths = getenv("DYLD_LIBRARY_PATH") { | |
userLibPaths.characters.split{$0 == ":"}.forEach { | |
let path = String($0) | |
if path.isDirectory { | |
args += ["-L\(path)"] | |
} | |
} | |
} |
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 String { | |
func trimBackTo(boundary: Character) -> String { | |
if isEmpty {return ""} | |
if self[endIndex.predecessor()] == boundary { return "" } | |
return characters.split(boundary).map(String.init).last! | |
} | |
func trimUpTo(boundary: Character) -> String { | |
if isEmpty { 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
struct Stack<T> { | |
private var store = [T]() | |
mutating func push(anObject: T) { | |
store.append(anObject) | |
} | |
mutating func pop() -> T? { | |
let lastItem = store.last |
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 LazyStore<Key: Hashable, Value> { | |
private var store: [Key : Value] = [:] | |
let builderClosure: Key -> Value? | |
init(builderClosure: Key -> Value?) { | |
self.builderClosure = builderClosure | |
} |
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 StackType { | |
typealias Element | |
mutating func push(element: Element) | |
mutating func pop() -> Element? | |
} | |
final class BufferStorage<Element> { | |
private var ptr: UnsafeMutablePointer<Element> | |
private let capacity: Int |
OlderNewer