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
NSString *errorString; | |
NSData *data = [NSPropertyListSerialization dataFromPropertyList:plist format:NSPropertyListXMLFormat_v1_0 errorDescription:&errorString]; | |
if (!data) | |
NSLog(@"%@", errorString); |
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
javascript:var a = document.getElementById('preload');a.style.marginLeft = '-200px';a.style.width = '1300px';a.style.height = '1200px';void(0); |
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
- (void)sendEvent:(NSEvent *)event { | |
if ([event type] == NSAppKitDefined && ([event subtype] & NSApplicationActivatedEventType) && [[event window] respondsToSelector:@selector(_popover)]) | |
return; | |
[super sendEvent:event]; | |
} |
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
if ([[NSUserDefaults standardUserDefaults] boolForKey:@"DebugAppleEvents"]) { | |
NSError *error = nil; | |
NSFileManager *fm = [NSFileManager defaultManager]; | |
NSURL *logsDir = [fm URLForDirectory:NSLibraryDirectory inDomain:NSUserDomainMask appropriateForURL:nil create:YES error:nil]; | |
logsDir = [logsDir URLByAppendingPathComponent:@"Logs"]; | |
logsDir = [logsDir URLByAppendingPathComponent:@"Paparazzi!"]; | |
if (![logsDir checkResourceIsReachableAndReturnError:&error]) { | |
if (![fm createDirectoryAtURL:logsDir withIntermediateDirectories:YES attributes:nil error:&error]) |
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> | |
int main(int argc, char *argv[]) { | |
@autoreleasepool { | |
NSString *str = @"foo|bar|baz\\|quux"; | |
BOOL lastWasBackslash = NO; | |
NSMutableString *sub = [NSMutableString string]; | |
NSMutableArray *matches = [NSMutableArray array]; | |
for (NSUInteger idx; idx < [str length]; ++idx) { |
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
Process: Adium [12517] | |
Path: /Applications/Internet/Adium.app/Contents/MacOS/Adium | |
Identifier: com.adiumX.adiumX | |
Version: 1.5.4b1 (1.5.4b1) | |
Code Type: X86-64 (Native) | |
Parent Process: launchd [256] | |
User ID: 501 | |
Date/Time: 2012-08-26 14:45:17.761 -0500 | |
OS Version: Mac OS X 10.8.1 (12B19) |
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
- (NSString *)stringByInsertingCenterEllipsisWithMaxWidth:(CGFloat)maxWidth font:(NSFont *)font { | |
NSDictionary *attrs = @{ NSFontAttributeName: font }; | |
NSSize size = [self sizeWithAttributes:attrs]; | |
if (size.width <= maxWidth) | |
return self; | |
NSMutableString *mutable = [self mutableCopy]; | |
NSMutableString *mutableWithEllipsis = nil; |
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
- (NSArray *)writableTypesForPasteboard:(NSPasteboard *)pasteboard { | |
// pasteboard must be stored away because there's no way to get it in -pasteboardPropertyListForType: :( | |
_currentPasteboard = pasteboard; | |
NSArray *types = @[(id)kPasteboardTypeFileURLPromise, (id)kPasteboardTypeFilePromiseContent]; | |
return types; | |
} | |
// ... |
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
# Toss in a directory | |
# Usage: make <binname> | |
# Compiles <binname>.m to <binname> | |
%: %.m | |
rm -f $@ | |
$(CC) $(CPPFLAGS) $(CFLAGS) -Wall -fobjc-arc -fmodules $^ -o $@ |
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
clang -dynamiclib -Os -Wl,-install_name,@rpath/libsqlite3.dylib -mmacosx-version-min=10.9 -o libsqlite3.dylib sqlite3.c |
OlderNewer