Skip to content

Instantly share code, notes, and snippets.

View atomicbird's full-sized avatar

Tom Harrington atomicbird

View GitHub Profile
import UIKit
let dateStr = "625083573.303378"
func date(for dateString: String) -> Date? {
guard let timestamp = Double(dateString) else { return nil }
return Date(timeIntervalSinceReferenceDate: timestamp)
date(for: dateStr)

Stump 360 questions from previous years, 2020 edition

Non-technical (mostly)

  • Three words were product code names for both Apple and Microsoft Products. Name any of them.
  • What was the first version of Mac OS X that Apple offered for free?
  • At which event (including year) did Tim Cook utter his famous “I don’t care about the bloody ROI!“? What was he referring to?
  • In official advertisements and photos, what time is displayed on all iPhones, iPads, and iMacs? And why?
  • Which is not an Apple prototype name?
    • Tommy
atomicbird / NSPersistentContainer+extension.swift
Created May 22, 2020 21:39
Back up and restore Core Data persistent stores
// NSPersistentContainer+extension.swift
// CDMoveDemo
// Created by Tom Harrington on 5/12/20.
// Copyright © 2020 Atomic Bird LLC. All rights reserved.
import Foundation
import CoreData
atomicbird / logMilestone.swift
Last active August 22, 2023 03:41
Sometimes you just want to print a message that tells you a line of code was executed. Inspired by a tweet from Paige Sun:
/// Log the current filename and function, with an optional extra message. Call this with no arguments to simply print the current file and function. Log messages will include an Emoji selected from a list in the function, based on the hash of the filename, to make it easier to see which file a message comes from.
/// - Parameter message: Optional message to include
/// - file: Don't use; Swift will fill in the file name
/// - function: Don't use, Swift will fill in the function name
/// - line: Don't use, Swift will fill in the line number
func logMilestone(_ message: String? = nil, file: String = #file, function: String = #function, line: Int = #line) -> Void {
// Feel free to change the list of Emojis, but don't make it shorter, because a longer list is better.
let logEmojis = ["😀","😎","😱","😈","👺","👽","👾","🤖","🎃","👍","👁","🧠","🎒","🧤","🐶","🐱","🐭","🐹","🦊","🐻","🐨","🐵","🦄","🦋","🌈","🔥","💥","⭐️","🍉","🥝","🌽","🍔","🍿","🎹","🎁","❤️","🧡","💛","💚","💙","💜","🔔"]
let logEmoji = logEmojis[abs(
atomicbird / wwdc2014
Created July 16, 2019 14:48 — forked from phnessu4/wwdc2014
wwdc 2014 sessions and pdf
atomicbird /
Last active May 29, 2020 22:59
WWDC 2019 Online-only Sessions

At WWDC 2019 Apple released some videos directly online, with no corresponding live session. This is a list of those videos with links to the video pages.

Some sessions were presented during WWDC but then split into multiple videos when posted online. This list includes the online versions, since they don't appear in the WWDC schedule. For example WWDC included session 711, "Introducing Combine and Advances in Foundation". This was split into two online videos-- 722, "Introducing Combine", and 723, "Advances in Foundation". Both 722 and 723 are included here.

atomicbird / UIView+comment.swift
Created May 16, 2019 16:50
Add a comment field in Xcode storyboards
@IBInspectable var comment: String {
set {}
get { return "" }
atomicbird /
Last active July 18, 2019 15:44 — forked from scarlac/
Facebook Hack: Purge list of "Advertisers you've interacted with"

For those of you who want to remove all in “Advertisers you’ve interacted with”:

  1. Go to and open the section "Advertisers you've interacted with"
  2. Open Web Inspector
  3. Copy-paste this script to load all advertisers: smt=setInterval(() => {let x=document.querySelector('div[shade=medium]'); x ? : clearInterval(smt), console.log('done')}, 1000)
  4. It will output a number. Wait for it to say “done” in the console. This may take a long time. you'll notice the scrollbar changing while it's loading all advertisers.
  5. Copy-paste this and press enter: document.querySelectorAll('[data-tooltip-content="Hide all ads from this advertiser"]').forEach(el => Note Facebook has changed the text on the button a few times, so if this has no effect, you may need to edit the command. Hover over the "x" icon on any advertiser until a pop-up tooltip appears. Make the double-quoted text in this c
atomicbird / ManagedObjectDeletionFiringFault.swift
Created March 5, 2018 23:20 — forked from AndrewBennet/ManagedObjectDeletionFiringFault.swift
A Swift playground demonstrating that deleting an NSManagedObject causes a fault to fire
import CoreData
import PlaygroundSupport
// Build a simple model in code for demo purposes.
// The model has a single entity called "Entity" with a single optional string attribute called "testAttribute".
// There are no relationships in the model.
let model = NSManagedObjectModel()
let entity = NSEntityDescription() = "Entity"
let testAttribute = NSAttributeDescription()
atomicbird /
Last active July 18, 2019 15:22
It's like Uber for howdy.
say "Warming up the pitch engine..."
for word in `sort -R /usr/share/dict/words`
PITCH="It's like Uber for $word."
echo $PITCH
say $PITCH
sleep 1