Skip to content

Instantly share code, notes, and snippets.

Daniel Dunbar ddunbar

Block or report user

Report or block ddunbar

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:c5058565691e0ec323d429994d77f9ba
Enter Mac mode:
Hold =, press m.
The top four thumb keys while in Mac mode, from left to right are: Command | Option | Ctrl | Command
Disable key clicks:
Hold Progrm, press -/_ (disable beeps).
Hold Progrm, press |/\ (disable clicks).
Key Remappings:
@ddunbar
ddunbar / Xcode-user-defaults
Last active Aug 22, 2019
Xcode user defaults
View Xcode-user-defaults
# Enable timings on build operations
defaults write com.apple.dt.Xcode ShowBuildOperationDuration -bool YES
# Enable extensive per-task timings
defaults write com.apple.dt.Xcode IDEBuildOperationTimingLogLevel -int 3
# Enable old build system logging for "implicit dependencies"
defaults write com.apple.dt.Xcode IDEBuildOperationDependenciesLogLevel -int 3
# Show logs from the "prebuild" step
@ddunbar
ddunbar / xcbuild-debugging-tricks.md
Last active Aug 26, 2019
Xcode new build system debugging tricks
View xcbuild-debugging-tricks.md

New Build System Tricks

Command Line

alias xcbuild=$(xcode-select -p)/../SharedFrameworks/XCBuild.framework/Versions/A/Support/xcbuild
# THIS DOESNT WORK YET: xcbuild openIDEConsole  # … then switch to Xcode ➡️
xcbuild showSpecs
xcbuild build <foo.pif> [—target <target>]
@ddunbar
ddunbar / TODO.md
Last active Aug 16, 2016
Personal Package Manager TODO List
View TODO.md

TODO

  • Eliminate POSIX imports from everything downstream of Basic.

  • Eliminate Utility module (clean up names here)

  • Clean up topological sort and closure algorithms

  • Speed up tests

View HashableBox.swift
/// Box for exposing an item as a hashable.
public struct HashableBox<T, H: Hashable>: Hashable {
/// The wrapped item.
public let item: T
private let accessor: (T) -> H
/// Create a new hashable box for `item` where `accessor` defines the hashable content.
public init(_ item: T, accessor: @escaping (T) -> H) {
self.item = item
@ddunbar
ddunbar / extensible-raw-values.swift
Created Aug 12, 2016
Extensible enum raw values
View extensible-raw-values.swift
import Foundation
struct X: Equatable, ExpressibleByStringLiteral {
let strings: Set<String>
init?(_ characters: String.CharacterView) {
let strings = Set<String>(String(characters).components(separatedBy: ",").map{ String($0) })
if strings.isEmpty {
return nil
}
View update-swift-dev (Linux)
#!/bin/sh
set -e
if [ -z "${CONFIGURATION}" ]; then
CONFIGURATION=debug
fi
# Create the development toolchain.
PLATFORM_KEY=linux-x86_64
@ddunbar
ddunbar / update-swift-dev
Created Jun 2, 2016
This is the script I currently use on OS X to get a working "swift-dev.xctoolchain" out of a built Swift. It isn't designed to work for anyone but me, but it should be easy to adapt. I always run this after every build, and then use `TOOLCHAINS=swift-dev swift build` (etc) to use the development compiler.
View update-swift-dev
#!/bin/sh
set -e
if [ -z "${CONFIGURATION}" ]; then
CONFIGURATION=debug
fi
# Create the development toolchain.
rm -rf ~/public/swift-project/build/Ninja-ReleaseAssert/swift-dev.xctoolchain
View OS X Say Status
$ cat ~/bin/status
#!/bin/sh
if [ $# -lt 2 ]; then
echo "Usage: $(basename $0) <exit-code> <name ...>"
echo
echo "This script is intended to be used along with a shell alias"
echo "such as:"
echo " alias status='status $?'"
echo "which will automatically add the last exit code."
You can’t perform that action at this time.