Skip to content

Instantly share code, notes, and snippets.

View TheDarkCode's full-sized avatar

Mark Hamilton TheDarkCode

View GitHub Profile
@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 / 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 / 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 / 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 / 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 / DecayCounter.swift
Created June 19, 2016 11:02
Half Life Equation in Swift
//
// DecayCounter.swift
// half-life-equation
//
// Created by Mark Hamilton on 6/19/16.
// Copyright © 2016 dryverless. All rights reserved.
//
import Foundation
@TheDarkCode
TheDarkCode / Delay.swift
Created June 22, 2016 08:09
Delay Utility for GCD in Swift 3
//
// Delay.swift
// Delay Utility for GCD in Swift 3
//
// Created by Mark Hamilton on 6/21/16.
// Copyright © 2016 dryverless. All rights reserved.
//
/*
@TheDarkCode
TheDarkCode / StateBoundaries.sql
Created October 6, 2018 20:34 — forked from jakebathman/StateBoundaries.sql
The approximate max/min latitude and longitude for all states and major territories
-- Create the table
CREATE TABLE IF NOT EXISTS `StateBoundaries` (
`State` varchar(10) DEFAULT NULL,
`Name` varchar(255) DEFAULT NULL,
`MinLat` varchar(50) DEFAULT NULL,
`MaxLat` varchar(50) DEFAULT NULL,
`MinLon` varchar(50) DEFAULT NULL,
`MaxLon` varchar(50) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@TheDarkCode
TheDarkCode / Program.cs
Created November 6, 2018 23:13
FBI Election Complaint Submission Client
using System;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using System.Collections.Generic;
namespace FBI.ElectionComplaint.Client
{
@TheDarkCode
TheDarkCode / DiscordBot.cs
Created December 22, 2018 08:51
Discord Bot .NET Core
using Discord;
using Discord.WebSocket;
using Discord.Commands;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;