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
// .h | |
@interface NSNull (null) | |
+ (void) setWarnsOnNullAccess:(BOOL) warnsOnNullAccess; | |
- (BOOL) boolValue; | |
- (char) charValue; | |
- (NSDecimal) decimalValue; | |
- (double) doubleValue; | |
- (float) floatValue; | |
- (int) intValue; |
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
#!/bin/sh | |
# Source: http://hints.macworld.com/article.php?story=20120701234338952 | |
# Have you ever been annoyed to find that your Mac won't got to sleep when you tell it to? | |
# It turns out that in Mac OS X 10.6 and later, there's a simple way of finding out what's | |
# keeping your Mac awake. | |
# Run the following command in your Terminal: | |
# pmset -g assertions |
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
# in 2012 by Johannes Fahrenkrug, http://springenwerk.com | |
# See you at WWDC! | |
require 'rubygems' | |
require 'open-uri' | |
class WWDC2012 | |
def self.announced? | |
begin | |
title = open('https://developer.apple.com/wwdc/') do |f| |
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
#!/bin/sh | |
# Watch this for a while, then ctrl-c | |
sudo fs_usage -w -f "filesys" |
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
A theory as to the ending of Breaking Bad... | |
White family: deceased | |
Hank and Marie: deceased | |
Kids: deceased | |
Walt: only one left, cancer cured | |
It was all for nothing. |
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
// | |
// NSObject+BlockObservation.h | |
// Version 1.0 | |
// | |
// Andy Matuschak | |
// andy@andymatuschak.org | |
// Public domain because I love you. Let me know how you use it. | |
// | |
#import <Cocoa/Cocoa.h> |
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
NSString *homer = | |
@"\n" | |
@" __ \n" | |
@" _ ,___,-'\",-=-. \n" | |
@" __,-- _ _,-'_)_ (\"\"`'-._\\ `. \n" | |
@" _,' __ |,' ,-' __) ,- /. | \n" | |
@" ,'_,--' | -' _)/ `\\ \n" | |
@" ,',' ,' ,-'_,` : \n" | |
@" ,' ,-' ,(,-( : \n" | |
@" ,' ,-' , _ ; \n" |
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
extern void EVILog(EVILogLevel level, NSString *fmt, ...); |
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
static EVILoggingCallback s_callback = nil; | |
#pragma mark - | |
void EVILog(EVILogLevel level, NSString *fmt, ...) | |
{ | |
va_list ap; | |
va_start(ap, fmt); | |
if(s_callback) |
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
@implementation AppDelegate | |
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification | |
{ | |
// ... | |
EVIRegisterLoggingCallback(^(EVILogLevel level, NSString *message) { | |
NSLog(@"EVIStreamer (%@): %@", EVILogLevelString(level), message); | |
}); | |
// ... | |
} |