Skip to content

Instantly share code, notes, and snippets.

@Dimentar
Dimentar / HTTPStatusCodes.swift
Created May 28, 2017 10:09 — forked from brennanMKE/HTTPStatusCodes.swift
Swift Enums for HTTP Status Codes
enum HTTPStatusCodes: Int {
// 100 Informational
case Continue = 100
case SwitchingProtocols
case Processing
// 200 Success
case OK = 200
case Created
case Accepted
case NonAuthoritativeInformation
ACTION = build
AD_HOC_CODE_SIGNING_ALLOWED = NO
ALTERNATE_GROUP = staff
ALTERNATE_MODE = u+w,go-w,a+rX
ALTERNATE_OWNER = grantdavis
ALWAYS_SEARCH_USER_PATHS = NO
ALWAYS_USE_SEPARATE_HEADERMAPS = YES
APPLE_INTERNAL_DEVELOPER_DIR = /AppleInternal/Developer
APPLE_INTERNAL_DIR = /AppleInternal
APPLE_INTERNAL_DOCUMENTATION_DIR = /AppleInternal/Documentation
// My Implementazion, not so performant like the original "CLRS", but less code
public extension Array where Element: Comparable {
private func merge(var l: [Element], var _ r: [Element]) -> [Element] {
var a = [Element]()
for _ in 0..<(l.count + r.count) {
if l.isEmpty || r.isEmpty {
return a + l + r
}
//: ## MergeSort Algorithm
// Merge Method -> Original from "CLRS"
public extension Array where Element: Comparable {
private mutating func merge(min min: Int, mid: Int, max: Int) -> [Element] {
var l = Array(self[min...mid]) // self[min...mid].map{$0}
var r = Array(self[mid+1...max]) // self[mid+1...max].map{$0}
var i = 0
var j = 0