Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000| #!/usr/bin/env bash | |
| set -Eeuo pipefail | |
| trap cleanup SIGINT SIGTERM ERR EXIT | |
| script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P) | |
| usage() { | |
| cat <<EOF | |
| Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...] |
| import UIKit | |
| fileprivate var __appDeviceSizeModel: UIDevice.DeviceSizeModel? | |
| extension UIDevice { | |
| public enum DeviceSizeModel { | |
| case unknown | |
| case iPhone4 | |
| case iPhone5 | |
| case iPhone6 | |
| case iPhone6Plus |
| import Foundation | |
| extension String { | |
| /// Получить цвет согласно hexa значению описаному в строке | |
| /// | |
| /// - Returns: UIColor | |
| func hexaColor() -> UIColor { | |
| return UIColor.hexaStringColor(self) | |
| } |
| git branch -m old_branch new_branch # Rename branch locally | |
| git push origin :old_branch # Delete the old branch | |
| git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote |
| struct Semaphore { | |
| let semaphore: dispatch_semaphore_t | |
| init(value: Int = 0) { | |
| semaphore = dispatch_semaphore_create(value) | |
| } | |
| // Blocks the thread until the semaphore is free and returns true | |
| // or until the timeout passes and returns false |
| import UIKit | |
| extension UIImage { | |
| func changeColor(with color: UIColor) -> UIImage? { | |
| UIGraphicsBeginImageContextWithOptions(self.size, false, UIScreen.main.scale) | |
| let context = UIGraphicsGetCurrentContext() | |
| context?.translateBy(x: 0, y: self.size.height) | |
| context?.scaleBy(x: 1.0, y: -1.0) |