Skip to content

Instantly share code, notes, and snippets.

View djtech42's full-sized avatar

Dan Turner djtech42

View GitHub Profile
@JohnSundell
JohnSundell / xcode-switch.sh
Created June 17, 2017 13:29
A script that switches between the App Store & beta versions of Xcode
#!/usr/bin/env bash
# This script switches between the App Store version of Xcode and the beta
# Install it by copying it to /usr/local/bin/xcode-switch and running 'chmod +x' on it (to make it executable)
# Then run it using 'sudo xcode-switch'
if [ "$EUID" -ne 0 ]; then
echo "xcode-select requires you to run this script as root; 'sudo xcode-switch'"
exit
fi
@andymatuschak
andymatuschak / States-v3.md
Last active June 12, 2024 04:17
A composable pattern for pure state machines with effects (draft v3)

A composable pattern for pure state machines with effects

State machines are everywhere in interactive systems, but they're rarely defined clearly and explicitly. Given some big blob of code including implicit state machines, which transitions are possible and under what conditions? What effects take place on what transitions?

There are existing design patterns for state machines, but all the patterns I've seen complect side effects with the structure of the state machine itself. Instances of these patterns are difficult to test without mocking, and they end up with more dependencies. Worse, the classic patterns compose poorly: hierarchical state machines are typically not straightforward extensions. The functional programming world has solutions, but they don't transpose neatly enough to be broadly usable in mainstream languages.

Here I present a composable pattern for pure state machiness with effects,

@kreeger
kreeger / xcode-and-el-capitan.md
Last active August 29, 2015 14:24
Re-enables launching of older versions of Xcode on El Capitan. Do so at your own risk!

Xcode 6 & El Capitan

Re-enables launching of older versions of Xcode on El Capitan. Xcode 6 supposedly has issues creating corrupt archives on El Capitan, which is why it's been disabled. Do so at your own risk!

  • Disable rootless (temporarily) with sudo nvram boot-args="kext-dev-mode=1 rootless=0"
  • Then reboot
  • open /System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/Exceptions.plist
  • change com.apple.dt.Xcode -> Item 0 -> HardDisabled from YES to NO
  • Reboot again, for good measure
  • Remove and reinstall Xcode, launch it, make sure it's good
@nicklockwood
nicklockwood / gist:21495c2015fd2dda56cf
Last active August 13, 2020 13:57
Thoughts on Swift 2 Errors

Thoughts on Swift 2 Errors

When Swift was first announced, I was gratified to see that one of the (few) philosophies that it shared with Objective-C was that exceptions should not be used for control flow, only for highlighting fatal programming errors at development time.

So it came as a surprise to me when Swift 2 brought (What appeared to be) traditional exception handling to the language.

Similarly surprised were the functional Swift programmers, who had put their faith in the Haskell-style approach to error handling, where every function returns an enum (or monad, if you like) containing either a valid result or an error. This seemed like a natural fit for Swift, so why did Apple instead opt for a solution originally designed for clumsy imperative languages?

I'm going to cover three things in this post:

@mickmaccallum
mickmaccallum / classes.swift
Created May 5, 2015 17:50
Missing NSObject introspection methods. isStrictSubclassOfClass(), isStrictSuperclassOfClass() and isSuperclassOfClass()
extension NSObject {
class func isStrictSubclassOfClass(aClass: AnyClass) -> Bool {
return isSubclassOfClass(aClass) && self !== aClass.self
}
class func isStrictSuperclassOfClass(aClass: AnyClass) -> Bool {
return isSuperclassOfClass(aClass) && self !== aClass.self
}
class func isSuperclassOfClass(aClass: AnyClass) -> Bool {
@egel
egel / audio_extensions
Created April 15, 2015 20:07
Big group of extensions (audio, text)
.caf Core Audio File 4.5 stars
.abm Music Album 4.5 stars
.oga Ogg Vorbis Audio File
.omf Open Media Framework File
.pla Sansa Playlist File
.asd Ableton Live Sample Analysis File
.bnk Adlib Instrument Bank
.bun Cakewalk Bundle File
.csh Cubase Waveform File
.hsb HALion Sound Bank File
@JadenGeller
JadenGeller / Swift Unless_When.swift
Last active May 21, 2019 16:11
Swift Unless/When
// Basically, these are if and else statements respectively
// without the opposite clause
func when(test: @autoclosure () -> Bool, action: () -> ()) {
if test() { action() }
}
func unless(test: @autoclosure () -> Bool, action: () -> ()) {
if !test() { action() }
}
@kevinelliott
kevinelliott / osx-10.10-setup.md
Last active December 1, 2023 08:21
Mac OS X 10.10 Yosemite Setup

Mac OS X 10.10 Yosemite

Custom recipe to get OS X 10.10 Yosemite running from scratch, setup applications and developer environment. I use this gist to keep track of the important software and steps required to have a functioning system after a semi-annual fresh install. On average, I reinstall each computer from scratch every 6 months, and I do not perform upgrades between distros.

This keeps the system performing at top speeds, clean of trojans, spyware, and ensures that I maintain good organizational practices for my content and backups. I highly recommend this.

You are encouraged to fork this and modify it to your heart's content to match your own needs.

Install Software

ASCIIwwdc Viewing Statistics

June 1, 2014 – September 15, 2014

Percentage of total visits for sessions among the top 100 pages on ASCIIwwdc.

Initial Takeaways

  • Vast majority of views for 2014 sessions, as might be expected
  • Top 6 most-watched session all involve view controllers & Interface Builder (accounting for 1/4 of total traffic)
  • "What's New in X" sessions are extremely popular
@staltz
staltz / introrx.md
Last active July 22, 2024 09:31
The introduction to Reactive Programming you've been missing