Skip to content

Instantly share code, notes, and snippets.

View markd2's full-sized avatar

Mark Dalrymple markd2

View GitHub Profile
I am not a fan of Xcode. Here are ~160~ 200 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
@markd2
markd2 / launchHandler.m
Created July 2, 2014 19:33
Simple utility that uses Launch Services to see what applications would be interested in editing a given file.
@import Foundation;
@import CoreServices;
// clang -g -fobjc-arc -fmodules launchHandler.m -o launchHandler
int main (int argc, const char *argv[]) {
// Rudimentary argument checking.
if (argc != 2) {
printf ("usage: %s filename\n", argv[0]);
@markd2
markd2 / endian.m
Created August 30, 2012 18:10
Explore endianness.
#import <Foundation/Foundation.h>
// Xcode_3_2_6/usr/bin/gcc -arch ppc -std=c99 -isysroot /Xcode_3_2_6/SDKs/MacOSX10.5.sdk -g -Wall -framework Foundation -o endian-ppc ~/Downloads/endian.m (thanks to Jeremy W. Sherman for the assist)
// clang -arch x86_64 -g -Weverything -framework Foundation -o endian endian.m
int main (void) {
unsigned int values[] = { 1, 387, 8533937 };
@markd2
markd2 / NSObject+setValuesForKeysWithJSONDictionary.h
Created July 18, 2013 13:44
Support files for Inside the Bracket Part 6, showing an actual use of the objective-C runtime API.
//
// NSObject+setValuesForKeysWithJSONDictionary.h
//
// Created by Tom Harrington on 12/29/11.
// Tweaked by Mark Dalrymple
//
// Copyright (c) 2011 Atomic Bird, LLC. All rights reserved.
//
#import <Foundation/Foundation.h>
@markd2
markd2 / runtime.m
Created July 9, 2013 20:55
Objective-C runtime metadata dumper.
#import <Foundation/Foundation.h>
#import <objc/runtime.h>
#import "typestring.h"
// clang -g -fobjc-arc -Wall -framework Foundation -o runtime typestring.m runtime.m
// Runtime reference, at least until Apple breaks the link
// http://developer.apple.com/library/ios/#documentation/Cocoa/Reference/ObjCRuntimeRef/Reference/reference.html
@markd2
markd2 / BNRDiggyDict.h
Created March 20, 2012 13:45
Objective-C Literals, part 2 support files.
#import <Foundation/Foundation.h>
@interface BNRDiggyDict : NSObject
// React to object indexing. Would be nice to have a @protocol for this
- (id) objectForKeyedSubscript: (id) key;
- (void) setObject: (id) thing forKeyedSubscript: (id<NSCopying>) key;
// And for fun, it also can react to scalar indexing.
// Returns the N'th key of the top-level collection.
Hi! Thanks for looking
TL;DR - trying to do anything with os_signpost, but nothing is appearing in instruments.
UPDATE: on devices it's working. Is it supposed to work in the simulator? Points of Interest are on built-in templates, I figured it should work on the device...
The app is all objc, using the C API. See at the end for a swift attempt
More details:
Creating the log like this:
@markd2
markd2 / serial.m
Created May 14, 2012 15:06
Playing with NSPropertyListSerialization
#import <Foundation/Foundation.h>
// clang -g -Wall -fobjc-arc -framework Foundation -o serial serial.m
static id makePlistObjects (void) {
NSMutableDictionary *top = [NSMutableDictionary dictionary];
[top setObject: @"Hi I'm a string" forKey: @"string"];
[top setObject: [NSNumber numberWithInt: 23] forKey: @"number"];
@markd2
markd2 / notification.m
Created July 16, 2012 23:15
Spying on notifications.
#import <Cocoa/Cocoa.h>
// clang -Weverything -fobjc-arc -framework Cocoa -o notification notification.m
void QuietLog (NSString *format, ...);
void StartSpying (void);
void StopSpying (void);
void QuietLog (NSString *format, ...) {
@markd2
markd2 / fast-enum-1.m
Created November 1, 2012 15:18
Basics of fast enumeration.
#import <Foundation/Foundation.h>
// clang -g -fobjc-arc -Weverything -framework Foundation -o fast-enum-1 fast-enum-1.m
#pragma clang diagnostic ignored "-Wobjc-missing-property-synthesis"
// --------------------------------------------------
// Pass-through
@interface Musician : NSObject
+ (id) musicianWithName: (NSString *) name instrument: (NSString *) instrument;