Skip to content

Instantly share code, notes, and snippets.

// .h
@interface NSNull (null)
+ (void) setWarnsOnNullAccess:(BOOL) warnsOnNullAccess;
- (BOOL) boolValue;
- (char) charValue;
- (NSDecimal) decimalValue;
- (double) doubleValue;
- (float) floatValue;
- (int) intValue;
#!/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
@tternes
tternes / wwdc2012.rb
Last active December 12, 2015 12:19 — forked from jfahrenkrug/wwdc2013.rb
# 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|
#!/bin/sh
# Watch this for a while, then ctrl-c
sudo fs_usage -w -f "filesys"
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.
//
// 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>
@tternes
tternes / NSHomerString
Created November 25, 2013 18:05
NSHomerString
NSString *homer =
@"\n"
@" __ \n"
@" _ ,___,-'\",-=-. \n"
@" __,-- _ _,-'_)_ (\"\"`'-._\\ `. \n"
@" _,' __ |,' ,-' __) ,- /. | \n"
@" ,'_,--' | -' _)/ `\\ \n"
@" ,',' ,' ,-'_,` : \n"
@" ,' ,-' ,(,-( : \n"
@" ,' ,-' , _ ; \n"
extern void EVILog(EVILogLevel level, NSString *fmt, ...);
static EVILoggingCallback s_callback = nil;
#pragma mark -
void EVILog(EVILogLevel level, NSString *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
if(s_callback)
@implementation AppDelegate
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
// ...
EVIRegisterLoggingCallback(^(EVILogLevel level, NSString *message) {
NSLog(@"EVIStreamer (%@): %@", EVILogLevelString(level), message);
});
// ...
}