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 UIKit | |
extension UIColor { | |
static func colorWithHex(hex RGBAHex: String) -> UIColor? { | |
if !RGBAHex.hasPrefix("#") { | |
return nil | |
} | |
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
export PS1="\w \[\e[0;33m\]\`ruby ~/.theme/git.rb\` \[\e[0m\]\\$ " |
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
function branch_status { | |
branch=`branch` | |
[ -n "$branch" ] && echo "[$branch`dirty_status`] " || echo | |
} | |
function branch { | |
git branch | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/' | |
} | |
function dirty_status { |
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
//: Playground - noun: a place where people can play | |
import Foundation | |
/// A type describing a JSON object. | |
public typealias JSONObject = Any | |
/// Provides information about an error which occured when trying to decode the JSON object. | |
public enum DecodingError: Error { | |
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
//: Playground - noun: a place where people can play | |
import UIKit | |
func helloWorld() -> Void { | |
print("hello, world!") | |
} | |
helloWorld() |
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
protocol Foo { | |
func foo(_ int: Int) | |
} | |
extension Foo { | |
func foo(_ int: Int = 1) { print("foo") } | |
func bar() { print("bar") } | |
} | |
func testFoo(foo: Foo) { |
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
/// 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 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 | |
import UIKit | |
protocol Async: class, Task { | |
} | |
extension Waterfall: Async { | |
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
//: Playground - noun: a place where people can play | |
import Foundation | |
extension URLRequest { | |
/// The cURL representation of the URLRequest, useful for debugging and executing requests outside of the app. | |
public var cURLCommand: String { | |
var command = "curl" |
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
extension String { | |
func unescapeHTMLEntities() throws -> String { | |
guard contains("&#") else { | |
return self | |
} | |
guard let data = data(using: .utf8) else { | |
return self |
OlderNewer