This file contains hidden or 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
(lldb) b NSLog | |
Breakpoint 2: 2 locations. | |
(lldb) breakpoint command add -s python -o "return (frame.GetThread().GetFrameAtIndex(1).GetModule().GetFileSpec().GetFilename() == 'UIKit')" |
This file contains hidden or 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
- On 10.6 and 10.7 System Preferences's 64-bit image requires GC. If the user opens a preference pane | |
that does not support GC System Preferences will restart as a 32-bit process, provided that the | |
preference pane has a 32-bit image. | |
- On 10.8+ System Preferences's 64-bit image supports GC but does not require it, and by default it | |
launches with GC disabled. If the user opens a preference pane that requires GC System Preferences | |
relaunches with GC enabled, but still as a 64-bit process. | |
So if your deployment target is <= 10.7 you'll get the best user experience by building with | |
GCC_ENABLE_OBJC_GC = supported, as the preference pane will run on all platforms without requiring a |
This file contains hidden or 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
#include <znc/Modules.h> | |
using namespace std; | |
static const char evil[] = { (char)0xd8, (char)0xb3, 0 }; | |
class CFilterMod : public CModule { | |
public: | |
MODCONSTRUCTOR(CFilterMod) { | |
} |
This file contains hidden or 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 <mach-o/dyld.h> | |
#import <mach-o/getsect.h> | |
#import <mach-o/ldsyms.h> | |
// Embed via other linker flags: -sectcreate __TEXT test $(PROJECT_DIR)/test.txt | |
// Names are limited to 16 characters. | |
NSData *MSEmbeddedResourceDataWithName(NSString *name) { | |
unsigned long size = 0; | |
uint8_t *data = getsectiondata(&_mh_execute_header, "__TEXT", [name UTF8String], &size); |
This file contains hidden or 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 <SenTestingKit/SenTestingKit.h> | |
@interface GoogleTests : SenTestCase | |
@end |
This file contains hidden or 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
- (BOOL)fileHasCustomIcon:(NSString *)path { | |
struct FinderInfoAttrBuf { | |
u_int32_t length; | |
FileInfo fileInfo; | |
ExtendedFileInfo extendedFileInfo; | |
} __attribute__((aligned(4), packed)); | |
struct attrlist attrList = {}; | |
struct FinderInfoAttrBuf attrBuf = {}; | |
attrList.bitmapcount = ATTR_BIT_MAP_COUNT; |
This file contains hidden or 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
NSSharingService *service = [NSSharingService sharingServiceNamed:NSSharingServiceNameComposeEmail]; | |
NSDictionary *parameters = @{ | |
@"NSSharingServiceParametersDefaultSubjectKey": @"Lo, a subject!", | |
@"NSSharingServiceParametersDefaultRecipientsKey": @[@"[email protected]"] | |
}; | |
[service setValue:parameters forKey:@"parameters"]; | |
[service performWithItems:@[@"Woo, private API."]]; |
This file contains hidden or 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
LSSharedFileListRef recentDocsList = LSSharedFileListCreate(NULL, kLSSharedFileListRecentDocumentItems, NULL); | |
LSSharedFileListRemoveAllItems(recentDocsList); | |
CFRelease(recentDocsList); |
This file contains hidden or 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
NSImage *computerImage = [NSImage imageNamed:NSImageNameComputer]; | |
NSInteger size = 256; | |
NSBitmapImageRep *rep = [[NSBitmapImageRep alloc] | |
initWithBitmapDataPlanes:NULL | |
pixelsWide:size | |
pixelsHigh:size | |
bitsPerSample:8 | |
samplesPerPixel:4 | |
hasAlpha:YES |
This file contains hidden or 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
NSDate *now = [NSDate date]; | |
NSCalendar *calendar = [NSCalendar currentCalendar]; | |
NSDateComponents *nowComponents = [calendar components:NSSecondCalendarUnit fromDate:now]; | |
NSDateComponents *offsetComponents = [[NSDateComponents alloc] init]; | |
[offsetComponents setMinute:1]; | |
[offsetComponents setSecond:-[nowComponents second]]; | |
NSDate *nextMinute = [calendar dateByAddingComponents:offsetComponents toDate:now options:0]; | |
NSTimeInterval interval = [nextMinute timeIntervalSinceDate:now]; |
NewerOlder