- Don't add code cruft. Avoid parentheses around conditions in if-statements or with the
returnkeyword. Don't add semicolons except where syntactically demanded in statements or to separate statements on the same line. - Don't use ALL_CAPS; use camelCase
- Don't fight type inference. Use enumeration prefixes, self-references, and class names (with constructors) only when necessary or to clarify coding intent.
- Don't use
varwhenletis appropriate, especially for properties. The compiler better optimizesletstatements for items whose values will not change during their lifetime. For example, Apple writes, "It is good practice to create immutable collections in all cases where the collection does not need to change. Doing so enables the Swift compiler to optimize the performance of the collections you create." - Don't use classes when structs will do. Use class
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
| # Ruby is our language as asciidoctor is a ruby gem. | |
| lang: ruby | |
| before_install: | |
| - sudo apt-get install pandoc | |
| - gem install asciidoctor | |
| script: | |
| - make | |
| after_success: | |
| - .travis/push.sh | |
| env: |
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
| language: ruby | |
| rvm: | |
| - 2.0.0 | |
| env: | |
| global: | |
| - USER="username" | |
| - EMAIL="[email protected]" | |
| - REPO="name of target repo" | |
| - FILES="README.md foo.txt bar.txt" | |
| - GH_REPO="github.com/${USER}/${REPO}.git" |
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
| 1. You mast have a public key from your mashine stored on github as SSH key here: | |
| https://github.com/settings/ssh | |
| How to create ssh key on unix/mac os x: | |
| - Open terminal, go to the root typing: $ cd ~ (recommended) | |
| - Type: ssh-keygen -t rsa -C "[email protected]" | |
| - To secure your ssh key ststem will ask you for passphrase (recommended) but you can skip it also | |
| - That's you have the ssh key | |
| - Check it with: $ ls -al ~/.ssh |
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
| //: Playground - noun: a place where people can play | |
| // Place included Localizable.stringsdict in ~/Documents/Shared Playground Data | |
| import AppKit | |
| import XCPlayground | |
| let bundle = NSBundle(URL: XCPlaygroundSharedDataDirectoryURL)! | |
| let format = NSLocalizedString("PhotosMoviesRemaining", tableName: nil, bundle: bundle, value: "", comment: "") |
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 NSDate { | |
| class func dateFromISO8601String(string: String?) -> NSDate? { | |
| guard let string = string else { | |
| return nil | |
| } | |
| var tm = Darwin.tm() |
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
| #!/bin/bash | |
| killall Xcode | |
| xcrun -k | |
| xcodebuild -alltargets clean | |
| rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang/ModuleCache" | |
| rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang.$(whoami)/ModuleCache" | |
| rm -rf ~/Library/Developer/Xcode/DerivedData/* | |
| rm -rf ~/Library/Caches/com.apple.dt.Xcode/* | |
| open /Applications/Xcode.app |
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
| exec > /tmp/${PROJECT_NAME}_archive.log 2>&1 | |
| UNIVERSAL_OUTPUTFOLDER=${BUILD_DIR}/${CONFIGURATION}-universal | |
| if [ "true" == ${ALREADYINVOKED:-false} ] | |
| then | |
| echo "RECURSION: Detected, stopping" | |
| else | |
| export ALREADYINVOKED="true" |
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
| /// This is a list of Hypertext Transfer Protocol (HTTP) response status codes. | |
| /// It includes codes from IETF internet standards, other IETF RFCs, other specifications, and some additional commonly used codes. | |
| /// The first digit of the status code specifies one of five classes of response; an HTTP client must recognise these five classes at a minimum. | |
| enum HTTPStatusCode: Int, Error { | |
| /// The response class representation of status codes, these get grouped by their first digit. | |
| enum ResponseType { | |
| /// - informational: This class of status code indicates a provisional response, consisting only of the Status-Line and optional headers, and is terminated by an empty line. | |
| case informational |
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 | |
| /* | |
| This is used by NSNotification.Name to allow enum-like members, | |
| but where new members can be added in an extension! | |
| enum Directions: String { | |
| case north = "North" | |
| } | |