Skip to content

Instantly share code, notes, and snippets.

View huntermonk's full-sized avatar

Hunter Maximillion Monk huntermonk

View GitHub Profile
@huntermonk
huntermonk / rotation-point.swift
Created October 24, 2018 21:28
Potential answer for Rotation Point question in Interview Cake.
func findRotationPoint(in words: [String]) -> Int {
let firstWord = words[0]
var floorIndex = 0
var ceilingIndex = words.count - 1
while floorIndex < ceilingIndex {
// guess a point halfway between floor and ceiling
let guessIndex = floorIndex + ((ceilingIndex - floorIndex) / 2)
let presentedViewController: UIViewController? = UIViewController()
struct Route {
var animateTransition: Bool
}
let route = Route(animateTransition: true)
let animated = presentedViewController == nil && route.animateTransition == false ? false : true
import Foundation
import UIKit
import PlaygroundSupport
extension String {
func toColorIncludingAlpha() -> UIColor? {
var cString: String = self
.trimmingCharacters(in: .whitespacesAndNewlines)
.replacingOccurrences(of: "#", with: "")
extension Int {
var ordinal:String {
get {
if self == 0 {
return "0"
}