Skip to content

Instantly share code, notes, and snippets.

View ddunbar's full-sized avatar

Daniel Dunbar ddunbar

View GitHub Profile
$ 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."
@ddunbar
ddunbar / update-swift-dev
Created June 2, 2016 17:35
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.
#!/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
#!/bin/sh
set -e
if [ -z "${CONFIGURATION}" ]; then
CONFIGURATION=debug
fi
# Create the development toolchain.
PLATFORM_KEY=linux-x86_64
@ddunbar
ddunbar / extensible-raw-values.swift
Created August 12, 2016 18:11
Extensible enum raw values
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
}
@ddunbar
ddunbar / HashableBox.swift
Created August 14, 2016 17:38
HashableBox
/// 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 / TODO.md
Last active August 16, 2016 00:07
Personal Package Manager TODO List

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

@ddunbar
ddunbar / xcbuild-debugging-tricks.md
Last active April 13, 2024 15:41
Xcode new build system debugging tricks

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 / Xcode-user-defaults
Last active September 28, 2023 17:03
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

Office Hours

I have benefited greatly in my career from the help of others (and implicitly from being a white man). At this point, I would like to find more ways to contribute back to the community. I'm trying an "Office Hours" model where I spend several hours a week advising on any topic I feel competent to help with.

In general, I’m willing to help anyone who could use support in programming or software engineering. My skills are probably best suited to supporting mid-stage career software engineers, who are past the "student" phase but want help developing their skills or career (either by increasing impact or depth). I'm also happy to try my best to help people who are trying to land their first tech job.

Below is a list of areas I feel (somewhat) competent to mentor on, or at least discuss.

Languages