Skip to content

Instantly share code, notes, and snippets.

@DeepFriedTwinkie
DeepFriedTwinkie / Day5_NSViewController.swift
Last active December 18, 2016 16:02
AdventOfCode.com 2016/Day 5 Solution
//
// ViewController.swift
// AdventOfCodeMac
//
// Created by Scott Atkinson on 12/17/16.
// Copyright © 2016 Fathouse Software. All rights reserved.
//
import Cocoa
@DeepFriedTwinkie
DeepFriedTwinkie / Day6.playground.swift
Created December 18, 2016 18:30
AdventOfCode.com 2016/Day 6 Solution
import Foundation
//: ## Helpers
func string(fromFile name:String, fileExtension:String) -> String? {
if let filePath = Bundle.main.path(forResource:name, ofType:fileExtension) {
if let inputData = FileManager.default.contents(atPath: filePath) {
return String(data: inputData, encoding: .utf8)
}
@DeepFriedTwinkie
DeepFriedTwinkie / Day7.playground.swift
Last active December 20, 2016 14:31
AdventOfCode.com 2016/Day 7 Solution
import Foundation
//: ## Helpers
func string(fromFile name:String, fileExtension:String) -> String? {
if let filePath = Bundle.main.path(forResource:name, ofType:fileExtension) {
if let inputData = FileManager.default.contents(atPath: filePath) {
return String(data: inputData, encoding: .utf8)
}
@DeepFriedTwinkie
DeepFriedTwinkie / MixedArrayFilter.swift
Created March 19, 2019 20:33
Filter a mixed value array by type
protocol Token {
var isSomething: Bool {get}
}
struct BasicToken : Token {
let isSomething: Bool
}
struct FancyToken : Token {
let isSomething: Bool