Skip to content

Instantly share code, notes, and snippets.

View TheDarkCode's full-sized avatar

Mark Hamilton TheDarkCode

View GitHub Profile
@TheDarkCode
TheDarkCode / JulianDateAlgorithms.swift
Created April 17, 2016 06:32
Fliegal and Van Flandern Algorithm in Swift.
//: Playground - Julian Date Algorithms
//
// Created by Mark Hamilton on 4/16/16.
// Copyright © 2016 dryverless. All rights reserved.
//
import Foundation
public func fliegalAndVanFlandernAlgorithm(julianDate: Int) -> (month: Int, day: Int, year: Int) {
@TheDarkCode
TheDarkCode / IterateOverEnums.swift
Last active April 11, 2016 10:01
Example of how to iterate over an enum and return all the cases.
//
// IterateOverEnums.swift
// Example of how to scan over an enum and return all the cases.
//
// Created by Mark Hamilton on 4/9/16.
// Copyright © 2016 dryverless. All rights reserved.
//
import Foundation
@TheDarkCode
TheDarkCode / UnicodeScalars.playground
Last active April 6, 2016 11:10
Extensions for working with unicode scalars when doing string manipulations. Simple optimization in Swift 2.2 that can save valuable ms.
//: Unicode Scalar Playground
import Foundation
var str = "Hello, playground"
protocol _UnicodeScalarType {
func toChar() -> Character
@TheDarkCode
TheDarkCode / LevenshteinExtensions.swift
Last active April 27, 2017 14:13
Levenshtein distance algorithm written in Swift 2.2. Both a slow and highly optimized version are included.
//
// LevenshteinExtensions.swift
// Levenshtein distance algorithm written in Swift 2.2. Both a slow and highly optimized version are included.
//
// Created by Mark Hamilton on 3/31/16.
// Copyright © 2016 dryverless. All rights reserved.
//
import Foundation
@TheDarkCode
TheDarkCode / UITableViewExtensions.swift
Created March 26, 2016 07:05
animateData() and animateDataWithOptions Functions for UITableView
//
// UITableViewExtensions.swift
//
// Created by Mark Hamilton on 3/25/16.
// Copyright © 2016 dryverless. All rights reserved.
//
import Foundation
import UIKit
@TheDarkCode
TheDarkCode / TrailResult.swift
Created March 10, 2016 10:24
Example implementing AZResult class for results that are returned in a format as seen in the AngularAzureSearch repo samples.
//
// TrailResult.swift
// azure-search-basics
//
// Created by Mark Hamilton on 3/10/16.
// Copyright © 2016 dryverless. All rights reserved.
//
import Foundation
@TheDarkCode
TheDarkCode / AZResult.swift
Created March 10, 2016 10:22
Base class for all results that are returned by Azure Search.
//
// AZResult.swift
// azure-search-basics
//
// Created by Mark Hamilton on 3/10/16.
// Copyright © 2016 dryverless. All rights reserved.
//
import Foundation
@TheDarkCode
TheDarkCode / AZLocation.swift
Created March 10, 2016 10:20
Sample swift class to use with Azure Search results being returned to client.
//
// GeoJSON.swift
// azure-search-basics
//
// Created by Mark Hamilton on 3/10/16.
// Copyright © 2016 dryverless. All rights reserved.
//
import Foundation
@TheDarkCode
TheDarkCode / touchid-authentication-basics.swift
Created March 3, 2016 05:11
Example view controller to demonstrate the use of Touch ID with Swift.
//
// ViewController.swift
// touchid-authentication-basics
//
// Created by Mark Hamilton on 3/2/16.
// Copyright © 2016 dryverless. All rights reserved.
//
import UIKit
import LocalAuthentication
@TheDarkCode
TheDarkCode / SampleAnnotation.swift
Created February 21, 2016 14:36
Sample class for adding annotations to MKMapView.
//
// SampleAnnotation.swift
// Sample class for adding annotations to MKMapView.
//
// Created by Mark Hamilton on 2/21/16.
// Copyright © 2016 dryverless. All rights reserved.
//
import Foundation
import MapKit