Instantly share code, notes, and snippets.

View apple-iphone-batteries-slack-transcript.txt
it makes sense, and I suspect you’d see something similar on any device with a worn battery (edited)
basically everything battery powered changes clock speeds based on battery voltage level and whether you’re plugged in (_edit:_ also based on workload, so you’re not running at full speed and burning battery power when you’re not doing anything) (edited)
you can’t run a CPU at full speed when the battery voltage is low (edited)
so it follows that when the battery is worn out (and its top voltage is presumably lower), performance is consistently lower
the phone knows about battery age/wear, and takes that into account for the user-facing battery percentage meter
View cdz.dump1090.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">
View CDZScalingButton.h
// CDZScalingButton.h
// ScalingButton
// Created by Chris Dzombak on 10/17/15.
// Copyright © 2015 Chris Dzombak. All rights reserved.
@import UIKit;
View FileURL.swift
// FileURL.swift
// Created by Chris Dzombak on 11/16/16.
import Validated
public typealias FileURL = Validated<URL, FileURLValidator>
public struct FileURLValidator: Validator, _FileURL_Validating {
View Swift

Hello Everyone,

The Swift 3 release is nearing completion, so it is time to look back on the release, learn from what happened, and use it to shape what we (the Swift community) do in the year ahead. Overall, Swift 3 is going to be an absolutely amazing release, and it is impressive how much got done. Thank you to everyone who contributed to making it happen. Instead of diving into a flurry of new proposals immediately, it is important to take stock of where we are, and look at the bigger picture.

Metapoint: this email is ridiculously long and covers multiple topics. Instead of replying to it directly, it is best to start new threads on individual topics that you’d like to discuss. Just tag them with “[Swift 4]” in the subject line.

Swift 3 Retrospective

Every year of Swift’s development has been completely different from the previous one, and I expect Swift 4 to continue this trend. With a goal of learning and improving year over year, here are some observations & retrospective about Swi

View Controller.swift
protocol ThingDelegate: class {
var fooString: String { get }
func foo()
class Controller: ThingDelegate {
let fooString: String
func foo() {

Keybase proof

I hereby claim:

  • I am cdzombak on github.
  • I am dzombak ( on keybase.
  • I have a public key whose fingerprint is A2D3 B712 8258 EAF7 72B6 EB00 394E 28F2 E5BF E8EF

To claim this, I am signing this object:

View OptionalOr.swift
let nilString: String? = nil
let aString: String? = "a non-nil string"
print (nilString ?? "the string is nil")
print (aString ?? "the string is nil")
// if you don't want to use `??` …
// (inspired by Scala's Option's `getOrElse`)
extension Optional {
View OmniOutliner Selected Rows to OmniFocus.scpt
tell application id "OOut"
set doc_name to name of front document
on error
display alert "No Document Open"
end try
View viewportfix.js
var m=document.getElementsByTagName('meta');
for(var i=0; i<m.length; i++) {
if (m[i].name == 'viewport') {
if (m[i].content.indexOf('user-scalable=0') != -1 || m[i].content.indexOf('user-scalable=no') != -1) {
m[i].content = 'width=device-width, initial-scale=1.0, minimum-scale=0.5, maximum-scale=4.0, user-scalable=1';
alert('Found & fixed.');