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
<html> | |
<head> | |
<title>Take Picture</title> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" /> | |
<meta name="apple-mobile-web-app-capable" content="yes"> | |
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"> | |
<link rel="apple-touch-icon-precomposed" href="http:/localhost:58844/webclips/images/Take%2520Picture/icon.png"> | |
<link rel="apple-touch-startup-image" media="(orientation: landscape)" href="http:/localhost:58844/webclips/images/Take%2520Picture/landscape-launch.png"/> | |
<link rel="apple-touch-startup-image" media="(orientation: portrait)" href="http:/localhost:58844/webclips/images/Take%2520Picture/portrait-launch.png"/> |
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 | |
func findFiles(rootPath: String, suffix: String, ignoreDirs: Bool = true) -> [String]? { | |
var result = [String]() | |
let fileManager = FileManager.default | |
if let paths = fileManager.subpaths(atPath: rootPath) { | |
let swiftPaths = paths.filter { $0.hasSuffix(suffix) } | |
for path in swiftPaths { | |
var isDir : ObjCBool = false | |
let fullPath = (rootPath as NSString).appendingPathComponent(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
import Foundation | |
func run(command: String, wait: Bool = true) -> String? { | |
let task = Process() | |
task.launchPath = "/bin/bash" | |
task.arguments = ["-c", command] | |
let pipe = Pipe() | |
task.standardOutput = pipe | |
task.launch() | |
guard wait else { |
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 ImmutableCopy { | |
associatedtype InitializerTuple | |
var lastInitParams: AnyInitializerParams<InitializerTuple> { get } | |
func copy(from: (InitializerTuple) -> Self, applying: (inout InitializerTuple) -> Void) -> Self | |
} | |
extension ImmutableCopy { | |
func copy(from: (InitializerTuple) -> Self, applying: (inout InitializerTuple) -> Void) -> Self { | |
var values = lastInitParams.values | |
applying(&values) |
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
// These little spaces are invisible in Xcode. Copy them around and watch everything break! | |
func foo(arg: Int) { | |
print("\(arg)") | |
} |
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
final class Heap<T> { | |
typealias Comparator = (T,T) -> Bool | |
var elements: [T] | |
let priority: Comparator | |
init(elements: [T], priority: @escaping Comparator) { | |
self.priority = priority | |
self.elements = elements |
OlderNewer