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 Cocoa | |
enum Animal { | |
case aardvark(NSWindow.StyleMask) | |
case bear | |
case cat | |
} | |
func isNotCat(_ animal: Animal) -> Bool { | |
switch animal { |
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
whitelist_rules: # only these rules will be applied | |
- line_length | |
- file_length | |
- function_body_length | |
- type_body_length | |
- type_name | |
- identifier_name | |
- class_delegate_protocol | |
- weak_delegate | |
- anyobject_protocol |
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
enum Faction { | |
case empire | |
case rebels | |
} | |
let characters: [(name: String, faction: Faction, episodes: [Int])] = [ | |
(name: "Darth Maul", faction: .empire, episodes: [1]), | |
(name: "Han Solo", faction: .rebels, episodes: [4, 5, 6]), | |
(name: "Palpatine", faction: .empire, episodes: [1, 2, 3, 5, 6]), | |
(name: "R2-D2", faction: .rebels, episodes: [1, 2, 3, 4, 5, 6]), |
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 Compression | |
/// A convenience class for compressing an NSData object. | |
/// | |
/// Example: | |
/// ``` | |
/// let compression = Compression(algorithm: .ZLIB) | |
/// let compressedData = compression.compressData(data) | |
/// let decompressedData = compresison.decompressData(compressedData) |
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 | |
private class Nothing: Decodable { } | |
func decodeArray<T, U: Decodable>(_ container: KeyedDecodingContainer<T>, forKey key: T) throws -> [U] { | |
var unkeyedContainer = try container.nestedUnkeyedContainer(forKey: key) | |
var objects: [U] = [] | |
while !unkeyedContainer.isAtEnd { | |
do { | |
let object = try unkeyedContainer.decode(U.self) |
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
#!/usr/bin/xcrun swift | |
println("Hello, World!") |
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>FILEHEADER</key> | |
<string> | |
// ___COPYRIGHT___ | |
//</string> | |
</dict> | |
</plist> |
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
# Xcode | |
.DS_Store | |
*/build/* | |
*.pbxuser | |
!default.pbxuser | |
*.mode1v3 | |
!default.mode1v3 | |
*.mode2v3 | |
!default.mode2v3 | |
*.perspectivev3 |
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
/* | |
* syscon - A tool for reading the system console from an iOS device | |
* via USB and displaying it in the OS X terminal in "real time". | |
* | |
* This tool and its source code is hereby released into the public domain. | |
* No warranty given, no responsibility taken. Use at your own risk. | |
* | |
* How to build: | |
* | |
* clang -o syscon -framework CoreFoundation -framework MobileDevice |
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 numberStrings = (1...10).map(String.init) |
NewerOlder