Here is the looks and feel of your terminal once the tutorial has been applied on your system:
Using Homebrew:
Here is the looks and feel of your terminal once the tutorial has been applied on your system:
Using Homebrew:
| extension String { | |
| init<T>(dumping x: T) { | |
| self.init() | |
| dump(x, to: &self) | |
| } | |
| } | |
| func assertDumpsEqual<T>(_ lhs: @autoclosure () -> T, _ rhs: @autoclosure () -> T, file: StaticString = #file, line: UInt = #line) { | |
| assert(String(dumping: lhs()) == String(dumping: rhs()), "Expected dumps to be equal.", file: file, line: line) | |
| } |
| import UIKit | |
| extension UIApplication { | |
| private struct AssociatedObjectsKeys { | |
| static var visibleViewControllersPointers = "UIApplication_visibleViewControllersPointers" | |
| } | |
| fileprivate var visibleViewControllersPointers: NSPointerArray { | |
| var pointers = objc_getAssociatedObject(self, &AssociatedObjectsKeys.visibleViewControllersPointers) as! NSPointerArray? |
| // | |
| // NSNull+LCFMessageForwarding.h | |
| // NSNull | |
| // | |
| // Created by leichunfeng on 15/12/22. | |
| // Copyright © 2015年 leichunfeng. All rights reserved. | |
| // | |
| #import <Foundation/Foundation.h> |
| extension String { | |
| func size(withAttributes attrs: [String:AnyObject], constrainedTo box: NSSize) -> NSRect { | |
| let storage = NSTextStorage(string: self) | |
| let container = NSTextContainer(containerSize: NSSize(width: box.width, height: box.height)) | |
| let layout = NSLayoutManager() | |
| layout.addTextContainer(container) | |
| storage.addLayoutManager(layout) | |
| storage.addAttributes(attrs, range: NSMakeRange(0, storage.length)) | |
| container.lineFragmentPadding = 0.0 | |
| let _ = layout.glyphRangeForTextContainer(container) |
| #!/bin/bash | |
| # Link: <https://gist.github.com/jellybeansoup/db7b24fb4c7ed44030f4> | |
| # | |
| # A command-line script for incrementing build numbers for all known targets in an Xcode project. | |
| # | |
| # This script has two main goals: firstly, to ensure that all the targets in a project have the | |
| # same CFBundleVersion and CFBundleShortVersionString values. This is because mismatched values | |
| # can cause a warning when submitting to the App Store. Secondly, to ensure that the build number | |
| # is incremented appropriately when git has changes. | |
| # |
| import Foundation | |
| typealias CancelableTask = (cancel: Bool) -> Void | |
| func delay(time: NSTimeInterval, work: dispatch_block_t) -> CancelableTask? { | |
| var finalTask: CancelableTask? | |
| var cancelableTask: CancelableTask = { cancel in | |
| if cancel { |
| // | |
| // main.swift | |
| // mutablecomposition | |
| // | |
| // Created by Kevin Meaney on 24/08/2015. | |
| // Copyright (c) 2015 Kevin Meaney. All rights reserved. | |
| // | |
| import Foundation |
| # Tips from: http://xcodehelp.blogspot.ie/2012/05/add-version-number-to-settings-screen.html | |
| # Reference from: https://developer.apple.com/library/mac/documentation/DeveloperTools/Reference/XcodeBuildSettingRef/1-Build_Setting_Reference/build_setting_ref.html | |
| # Get the correct path for the git binary | |
| git=`sh /etc/profile; which git` | |
| # Save paths for the project and target Info.plist | |
| projectPlistPath="${PROJECT_DIR}/${INFOPLIST_FILE}" | |
| targetPlistPath="${TARGET_BUILD_DIR}/${INFOPLIST_PATH}" |
| #!/bin/bash | |
| # update_build_number.sh | |
| # Usage: `update_build_number.sh [branch]` | |
| # Run this script after the 'Copy Bundle Resources' build phase | |
| # Ref: http://tgoode.com/2014/06/05/sensible-way-increment-bundle-version-cfbundleversion-xcode/ | |
| branch=${1:-'master'} | |
| buildNumber=$(expr $(git rev-list $branch --count) - $(git rev-list HEAD..$branch --count)) | |
| echo "Updating build number to $buildNumber using branch '$branch'." |