- Pastebot
- GIF Brewery
- Slack
- Keynote/Pages/Numbers
- 1Password
- OmniFocus 3
- Airmail 3
- iA Writer
@propertyWrapper | |
public struct AnyProxy<EnclosingSelf, Value> { | |
private let keyPath: ReferenceWritableKeyPath<EnclosingSelf, Value> | |
public init(_ keyPath: ReferenceWritableKeyPath<EnclosingSelf, Value>) { | |
self.keyPath = keyPath | |
} | |
@available(*, unavailable, message: "The wrapped value must be accessed from the enclosing instance property.") | |
public var wrappedValue: Value { |
// | |
// Activity.swift | |
// | |
// Created by Zachary Waldowski on 8/21/16. | |
// Copyright © 2016 Zachary Waldowski. Licensed under MIT. | |
// | |
import os.activity | |
private final class LegacyActivityContext { |
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,
PS: If you liked this talk or like this concept, let's chat about iOS development at Stitch Fix! #shamelessplug
Speaker: David Abrahams. (Tech lead for Swift standard library)
-
"Crusty" is an old-school programmer who doesn't trust IDE's, debuggers, programming fads. He's cynical, grumpy.
-
OOP has been around since the 1970's. It's not actually new.
-
Classes are Awesome
- Encapsulation
- Access control
#!/bin/bash | |
# Xcode: Set version and build number from Git | |
# -------------------------------------------- | |
# | |
# This script sets the version number `CFBundleShortVersionString` to one of | |
# | |
# - `1.2.3` -- for the tagged commit `v1.2.3` or a hyphen-separated prerelease, | |
# e.g. `v1.2.3-alpha`, `v1.2.3-alpha.2`, `v1.2.3-beta`, `v1.2.3-rc`. | |
# - `1.2.3-7-gabc1234` -- at commit `abc1234`, 7 commits after `v1.2.3`, | |
# - `1.2.3-7-gabc1234-dirty` -- when there are uncommitted changes, or |
extension Array { | |
func first() -> Element? { | |
if isEmpty { | |
return nil | |
} | |
return self[0] | |
} | |
func last() -> Element? { |
// | |
// NSFont+SystemFont.h | |
// xScope | |
// | |
// Created by Craig Hockenberry on 4/17/14. | |
// | |
// Thanks to http://nshipster.com/method-swizzling/ | |
#import <Cocoa/Cocoa.h> |
@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; | |
} | |
} |
#!/usr/bin/env ruby -wKU | |
# Comments added 6 March 2014. | |
# Implementation of the MetaWeblog API for my personal Ruby static blog generator. | |
# This is not even nearly idiomatic Ruby. There are all kinds of issues. | |
# (What's with the method interiors all being mushed-up together?) | |
# But -- it's also worked flawlessly for five years without my having to edit it. | |
# It won't work for anyone else as-is — but if it helps anyone | |
# to do a MetaWeblog API implementation, then cool. |