View typealias.swift
import SwiftSyntax
@greeble(bork) typealias Element = Int
let typeAliasKeyword = SyntaxFactory.makeTypealiasKeyword(leadingTrivia: .spaces(1),
trailingTrivia: .spaces(1))
let elementID = SyntaxFactory.makeIdentifier("Element", leadingTrivia: .zero, trailingTrivia: .spaces(1))
let equal = SyntaxFactory.makeEqualToken(leadingTrivia:, trailingTrivia: .spaces(1))
let intType = SyntaxFactory.makeTypeIdentifier("Int", leadingTrivia: .zero, trailingTrivia: .zero)
let initializer = SyntaxFactory.makeTypeInitializerClause(equal: equal, value: intType)
View activity.m
#import "ViewController.h"
#import <os/activity.h>
#import <os/log.h>
@interface ViewController ()
@end // extension
static os_activity_t g_appActivity;
View cgpath dump extension.swift
import CoreGraphics
private typealias CGPathDumpUtility = CGPath
extension CGPathDumpUtility {
func dump() {
self.apply(info: nil) { info, unsafeElement in
let element = unsafeElement.pointee
switch element.type {
View iconToggle.swift
import Cocoa
class ViewController: NSViewController {
var timer : Timer?
override func viewDidLoad() {
timer = Timer.scheduledTimer(withTimeInterval: 2.0, repeats: true) { timer in
View maskstuff.m
- (CGImageRef) newMaskFromImage: (UIImage *) image {
// Prior to 10.2 SDK / Xcode 8 (dunno which it is), the mask creation worked
// for all of the bucket overflow images. It failed afterwards. Dunno if the
// pngcrushing changed the color space unexpectedly, or what. But trying one and
// then falling back to the other seems to work ok now.
CGColorSpaceRef cs = CGColorSpaceCreateDeviceRGB ();
CGImageRef maskRef = CGImageCreateCopyWithColorSpace (image.CGImage, cs);
View ImageStore.swift
// Copyright © 2015 Big Nerd Ranch
import UIKit
class ImageStore {
let cache = NSCache<NSString, UIImage>()
View simple swift stack
import Foundation
class Stack<T> {
var storage = [T]()
func push(_ thing: T) {
func pop() -> T {
View Xcode is not my favorite tool
I am not a fan of Xcode. Here are over 160 problems, the first hundred or so issues were filed mostly in
July and August 2016 in a fit of rage. Mostly on weekends working (slowly) on side-projects. I have also
taken days of my employer's time filing others of these - so the company was not getting value for my time.
I believe a paid intern could have found many of these - just start a screen recorder, and when you see something,
stop and cut a quick movie. Many have been around for several major versions.
I'm volunteering chunks of my life (15-30 minutes per) to one of the most valuable companies in the world, which seems
kind of messed up. Things get worse the more complex the project and the longer Xcode been's running.
Apple folks - check out rdar://22524679
View what-are-you.txt
How many children were you meant to have? Heptapentuplets :-(
This inkblot test will assess your personality. Please stay where you are, we will be visiting shortly :-(
Can we guess your level of education? Stop eating your crayons :-(
What song sums up your entire life? Revolution #9
How Weird (percentage) are you? Sqwank :-(
Which Children's Book was written about you? The Night Dad Went To Jail :-(
Which Superhero are you in teh Comic World? Rorschach :-(
Which Keirsey Personality Type are You? Degenerate :-(
If you could write a note to your younger self, what would you say in only two words? sesquipedalian rhetoric
What is your maturity Level? "java.lang.Number.exception - negative number found" :-(
View gist:c09c9a03c8d48008aa06fccc335fe51b
NSUserCancelledError = 3072, // User cancelled operation (this one often doesn't deserve a panel and might be a good one to special case)
If you cancel an outstanding request (via the cancel method on the NSProgress object, or cancelling a parent progress object you have created) the completion handler argument to this method will be called back with an NSUserCancelledError in the NSCocoaErrorDomain.
BOOL _isCancelled;
/* Cancel all invocations of -coordinate... and -prepare... methods for the receiver. Any current invocation of one of those methods will stop waiting and return immediately, unless it has already invoked the passed-in block, in which case it will return when the passed-in block returns. Subsequent invocations of those methods will not invoke the blocks passed into them at all. When an invocation of -coordinate... or -prepare... returns without invoking the passed-in block because this method was invoked it instead returns an error whose domai