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
| // Asynchronous read | |
| let task = NSURLSession.sharedSession().streamTaskWithHostName("chat.example.com", port: 5555)! | |
| task.resume() | |
| task.readDataOfMinLength(16384, maxLength:65536, timeout: 30.0) { | |
| (data: NSData?, eof: Bool, error: NSError?) in | |
| // | |
| } |
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 UIKit | |
| extension UIView { | |
| @IBInspectable var cornerRadius: CGFloat { | |
| get { | |
| return layer.cornerRadius | |
| } | |
| set { |
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
| /*! | |
| @brief <#Краткое описание#> | |
| @discussion <#Длинное описание#> | |
| @code | |
| <#Пример использования#> | |
| @endcode | |
| @note <#Заметка#> | |
| @warning <#Предупреждение#> |
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
| cabal: /usr/bin/ar: permission denied | |
| sudo chmod a+x /usr/bin/ar |
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
| require 'digest/sha1' | |
| require 'json' | |
| file_names = Dir.entries(".").select do |f| | |
| f.end_with?(".png") || f == "pass.json" | |
| end | |
| manifest = {} | |
| file_names.each do |f| | |
| manifest[f] = Digest::SHA2.hexdigest(File.read(f)) |
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 XCTest | |
| extension XCTestCase { | |
| func expectationDataTask(dataTask: NSURLSessionDataTask) -> XCTestExpectation { | |
| dataTask.resume() | |
| let expectation = keyValueObservingExpectationForObject(dataTask, keyPath: "state") { _, _ in | |
| return dataTask.state == .Completed || dataTask.state == .Canceling | |
| } |
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
| func unimplemented(file: StaticString = #file, line: UInt = #line, function: StaticString = #function) -> NSError { | |
| let userInfo = [ | |
| NSLocalizedDescriptionKey: "`\(function)`is not implemented", | |
| NSLocalizedFailureReasonErrorKey: "\(file): \(line)" | |
| ] | |
| return NSError(domain: NSOSStatusErrorDomain, code: -4, userInfo: userInfo) | |
| } |
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
| TAGS="TODO:|FIXME:" | |
| echo "searching ${SRCROOT} for ${TAGS}" | |
| find "${SRCROOT}" \( -name "*.swift" \) -print0 \ | |
| | xargs -0 egrep --with-filename --line-number --only-matching "($TAGS).*\$" \ | |
| | perl -p -e "s/($TAGS)/ warning: \$1/" |
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
| /** | |
| <#Короткое описание.#> | |
| <#Длинное описание.#> | |
| ``` | |
| <#Пример использования#> | |
| ``` | |
| - Precondition: <#Предусловие.#> | |
| - Warning: <#Предупреждение.#> |
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 | |
| public enum Error: Int, ErrorType { | |
| public static let Domain = "Italmass.Error.Domain" | |
| case Missing | |
| case Invalid | |
| } | |
| extension NSError { |
OlderNewer