Skip to content

Instantly share code, notes, and snippets.

Alex Rozanski Perspx

Block or report user

Report or block Perspx

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Perspx
Perspx / versionScript.sh
Created Jan 1, 2014
Shell script which gets the version of a particular target from its info plist file
View versionScript.sh
targetName="..."
# Thanks to http://stackoverflow.com/a/13871762/75245 for help with the parsing.
relativeInfoPlistLocation=`/usr/bin/xcrun xcodebuild -showBuildSettings -target ${targetName} 2>/dev/null | grep "INFOPLIST_FILE" | sed 's/[ ]*INFOPLIST_FILE = //'`
absoluteInfoPlistLocation=${PROJECT_DIR}/$relativeInfoPlistLocation
version=`/usr/libexec/Plistbuddy -c 'Print :CFBundleShortVersionString' $absoluteInfoPlistLocation`
@Perspx
Perspx / PXProtocolMethodList.h
Last active Feb 22, 2017
Gets information about all methods that are defined in an Objective-C protocol. Returns an array of dictionaries with the selector and argument types for each method in NSString form.
View PXProtocolMethodList.h
#import <Foundation/Foundation.h>
extern NSString * const PXProtocolMethodListMethodNameKey;
extern NSString * const PXProtocolMethodListArgumentTypesKey;
NSArray *px_allProtocolMethods(Protocol *protocol);
@Perspx
Perspx / gist:972958
Created May 15, 2011
Reposition Traffic Lights
View gist:972958
NSButton *closeButton = [self standardWindowButton:NSWindowCloseButton];
NSView *themeFrame = [closeButton superview];
CGFloat buttonYOrigin = NSMaxY(themeFrame.frame)-34;
//Alter the button frames
NSRect closeFrame = closeButton.frame;
closeFrame.origin.y = buttonYOrigin;
closeButton.frame = closeFrame;
View NSArray+PXArrayAdditions.h
@interface NSArray (PXArrayAdditions)
- (id)initWithObject:(id)object;
- (id)firstObject;
@end
@Perspx
Perspx / NSMutableDictionary+PXDictionaryAdditions.h
Created Feb 18, 2010
NSMutableDictionary category to handle setting nil as an object for a key, adding [NSNull null] instead.
View NSMutableDictionary+PXDictionaryAdditions.h
#import <Cocoa/Cocoa.h>
@interface NSMutableDictionary (PXDictionaryAdditions)
- (BOOL)setObjectOrNull:(id)anObject forKey:(id)aKey;
@end
You can’t perform that action at this time.