Skip to content

Instantly share code, notes, and snippets.

keith /
Last active May 6, 2021
The matrix of Xcode build settings to compiler flags for Swift memory exclusivity
  • Compiler flag: -enforce-exclusivity=<value>

Xcode 10.1 & Swift 4.2

  • Compiler default for non optimized builds if you pass no argument is the same as if you passed checked
  • Compiler default for optimized builds if you pass no argument is the same as if you passed unchecked
Configuration Compiler Flag Value Build Setting Description Build Setting Value Notes
pepasflo / .gitignore
Last active Mar 26, 2021
Scripts for encrypting / decrypting secrets (to prevent them from being accidentally checked into git)
lsavino /
Last active Jul 27, 2022
Compiler Optimizations, Compiling Optimally, and Whole Modules

DEPRECATED for Xcode 10 🎈

(check out What's New in Swift at 11:40, slide 42)

Whole Module Compilation Optimizations: Why these terms are sometimes misleading

When you look up how to compile swift faster for debug builds, people very earnestly give advice that seems contradictory: you should "try using the whole module optimization flag," and also "never use whole module optimization for debugging". [^1]

This is confusing because some of us are using these two general words:

> compilation: "turning text into an executable program"

dylanmckay / facebook-contact-info-summary.rb
Last active Jan 6, 2022
A Ruby script for collecting phone record statistics from a Facebook user data dump
View facebook-contact-info-summary.rb
#! /usr/bin/env ruby
# NOTE: Requires Ruby 2.1 or greater.
# This script can be used to parse and dump the information from
# the 'html/contact_info.htm' file in a Facebook user data ZIP download.
# It prints all cell phone call + SMS message + MMS records, plus a summary of each.
# It also dumps all of the records into CSV files inside a 'CSV' folder, that is created
andymatuschak / MultiDirectionAdjudicatingScrollView.swift
Created Jan 26, 2015
Source for the Khan Academy app's unusual scrolling interactions
View MultiDirectionAdjudicatingScrollView.swift
// MultiDirectionAdjudicatingScrollView.swift
// Khan Academy
// Created by Andy Matuschak on 12/16/14.
// Copyright (c) 2014 Khan Academy. All rights reserved.
import UIKit
import UIKit.UIGestureRecognizerSubclass
quellish /
Created Oct 28, 2014
Xcode CI script variables



mattt / UTTypeForImageData.m
Created Mar 27, 2014
A quick function for determining an image's file type by its first couple of bytes
View UTTypeForImageData.m
@import MobileCoreServices;
static CFStringRef UTTypeForImageData(NSData *data) {
const unsigned char * bytes = [data bytes];
if (data.length >= 8) {
if (bytes[0] == 0x89 && bytes[1] == 0x50 && bytes[2] == 0x4E && bytes[3] == 0x47 && bytes[4] == 0x0D && bytes[5] == 0x0A && bytes[6] == 0x1A && bytes[7] == 0x0A) {
return kUTTypePNG;
steipete / gist:9021032
Created Feb 15, 2014
Run Script that converts TODO or FIXME or ??? into a warning. Super useful.
View gist:9021032
find "${SRCROOT}" \( -name "*.h" -or -name "*.m" \) -print0 | xargs -0 egrep --with-filename --line-number --only-matching "($KEYWORDS).*\$" | perl -p -e "s/($KEYWORDS)/ warning: \$1/"
nicegraham / gist:8727932
Created Jan 31, 2014
authorize instruments
View gist:8727932
# give access to instruments & co.
sudo security authorizationdb write system.privilege.taskport /var/tmp/system.privilege.taskport.plist
sudo security authorizationdb write /var/tmp/
sudo security authorizationdb write /var/tmp/