Skip to content

Instantly share code, notes, and snippets.

@keith
keith / exclusivity.md
Last active Nov 30, 2019
The matrix of Xcode build settings to compiler flags for Swift memory exclusivity
View exclusivity.md
  • Compiler flag: -enforce-exclusivity=<value>
  • Build setting: SWIFT_ENFORCE_EXCLUSIVE_ACCESS

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
pepasflo / .gitignore
Last active Jul 7, 2020
Scripts for encrypting / decrypting secrets (to prevent them from being accidentally checked into git)
@lsavino
lsavino / compilation-optimization.md
Last active May 25, 2020
Compiler Optimizations, Compiling Optimally, and Whole Modules
View compilation-optimization.md

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
dylanmckay / facebook-contact-info-summary.rb
Last active Jun 1, 2020
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
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
quellish / xcci.md
Created Oct 28, 2014
Xcode CI script variables
View xcci.md

Variable

Type

@mattt
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
steipete / gist:9021032
Created Feb 15, 2014
Run Script that converts TODO or FIXME or ??? into a warning. Super useful.
View gist:9021032
KEYWORDS="TODO:|FIXME:|\?\?\?:|\!\!\!:"
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
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 com.apple.dt.instruments.process.analysis /var/tmp/com.apple.dt.instruments.process.analysis.plist
sudo security authorizationdb write com.apple.dt.instruments.process.kill /var/tmp/com.apple.dt.instruments.process.kill.plist
You can’t perform that action at this time.