This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@interface NSString (TrimAdditions) | |
- (NSString *)stringByTrimmingCharactersInSet:(NSCharacterSet *)set options:(NSStringCompareOptions)options; | |
@end | |
@implementation NSString (TrimAdditions) | |
- (NSString *)stringByTrimmingCharactersInSet:(NSCharacterSet *)set options:(NSStringCompareOptions)options | |
{ | |
set = [set invertedSet]; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define GENERATE_PRAGMA(x) _Pragma(#x) | |
#define TODO(x) GENERATE_PRAGMA(message("[TODO] " #x)) | |
#define FIXME(x) GENERATE_PRAGMA(message("[FIXME] " #x)) | |
#define NOTE(x) GENERATE_PRAGMA(message("[NOTE] " #x)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
PSYObjCSupport.h | |
Created by Remy "Psy" Demarest on 04/08/2012. | |
Copyright (c) 2012. Remy "Psy" Demarest | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
#import <objc/runtime.h> | |
void _objc_insert_tagged_isa(unsigned char slotNumber, Class isa); | |
@interface _PSYTaggedArray : NSArray | |
@end | |
@implementation _PSYTaggedArray |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct RandomStruct { NSInteger columnSpan; }; | |
void WeirdStaticAnalyzerDiagnostic(void) | |
{ | |
struct TestStruct { struct RandomStruct strf; NSUInteger intf; } origin = { { 0 }, 0 }; | |
origin.strf = (struct RandomStruct){ 0 }; | |
struct TestStruct trigger = origin; | |
NSLog(@"%ld", trigger.intf); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
UIScrollView+TSAdditions.h | |
Created by Remy "Psy" Demarest on 03/07/2012. | |
Copyright (c) 2012 Remy "Psy" Demarest | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
#define OBJECT_BUFFER_SIZE 8 /* I don't necessary want to allocate too much memory there... */ | |
typedef struct _PSYMultiEnumState { | |
__unsafe_unretained id objectsBuf[OBJECT_BUFFER_SIZE]; | |
NSFastEnumerationState state; | |
unsigned long mutationPtrValue; | |
NSUInteger count; | |
NSUInteger position; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@interface PSYPaddingString : NSString | |
+ (id)paddingStringWithString:(NSString *)aString length:(NSUInteger)length; | |
- (id)initWithString:(NSString *)aString length:(NSUInteger)length; | |
@end | |
@implementation PSYPaddingString | |
{ | |
NSString *paddingString; | |
NSUInteger paddingLength; | |
NSUInteger stringLength; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSArray *arguments = nil; | |
char encode[] = "@@:@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"; | |
encode[[arguments count] + 3] = 0; | |
NSInvocation *inv = [NSInvocation invocationWithMethodSignature:[NSMethodSignature signatureWithObjCTypes:encode]]; | |
NSInteger idx = 2; | |
for(__unsafe_unretained id arg in arguments) |