Skip to content

Instantly share code, notes, and snippets.

View d2burke's full-sized avatar

Daniel Burke d2burke

View GitHub Profile
@d2burke
d2burke / Handling GraphQL Types with Protocols
Created June 10, 2023 13:59
This code seems like it should compile, conceptually, but it doesn't. Compiler says JobApplication doesn't conform to Hashable.
struct JobApplication: Hashable, Identifiable {
var id: String
var jobPostingId: String
var answers: [CustomQuestionAnswer]
var questions: [CustomQuestion]
}
protocol CustomQuestion: Hashable, Identifiable {
var id: String { get set }
var prompt: String { get set }
struct Profile: Codable {
var skills: [ProfileSkill]
var styles: [ProfileStyle]
var roles: [ProfileRole]
}
struct ProfileSkill: Codable {
var key: String
var label: String
}
@d2burke
d2burke / OMFG
Last active September 17, 2020 02:33
Swift v. SwiftUI Attributed Strings
// Swift Attributed Strings
let quote = "Holy fucking shit"
let firstAttributes: [NSAttributedString.Key: Any] = [.backgroundColor: UIColor.green, NSAttributedString.Key.kern: 10]
let secondAttributes = [NSAttributedString.Key.foregroundColor: UIColor.red]
let firstString = NSMutableAttributedString(string: "Holy ", attributes: firstAttributes)
let secondString = NSAttributedString(string: "fucking ", attributes: secondAttributes)
let thirdString = NSAttributedString(string: "shit")
//
// MKMapView+ZoomLevel.h
//
// Created by Daniel.Burke on 7/3/14 via Nikita Galayko @ StackOverflow
// Copyright (c) 2014 Forrent.com. All rights reserved.
//
#import <Foundation/Foundation.h>
#define MERCATOR_RADIUS 85445659.44705395
#define MAX_GOOGLE_LEVELS 20