Skip to content

Instantly share code, notes, and snippets.

View atnan's full-sized avatar

Nathan de Vries atnan

View GitHub Profile
$ cat /var/folders/p2/ks11y6qj4kb2dyyl7n5rydcm0000gn/T/com.apple.mail.drag/\[cocoaheadsau\]\ CocoaHeads\ Sydney\ August\ –\ For\ Real\ this\ time\! | tr -dc '!' | wc -c
24
/Developer/usr/include/_locale.h
/Developer/usr/include/_structs.h
/Developer/usr/include/_types.h
/Developer/usr/include/_wctype.h
/Developer/usr/include/_xlocale.h
/Developer/usr/include/aio.h
/Developer/usr/include/alloca.h
/Developer/usr/include/apache2
/Developer/usr/include/apache2/ap_compat.h
/Developer/usr/include/apache2/ap_config.h
@atnan
atnan / lightweight_toolchain.sh
Created July 27, 2011 07:06
Install a minimal development toolchain
#!/bin/env bash
packages=(
DevSDK.pkg
DeveloperToolsCLI.pkg
DeveloperToolsSystemSupport.pkg
gcc4.2.pkg
llvm-gcc4.2.pkg
clang.pkg
)
@atnan
atnan / gist:1100998
Created July 23, 2011 04:03
Creating arbitrarily-colored icons from a black-with-alpha master image (iOS)
// Usage example:
// input image: http://f.cl.ly/items/3v0S3w2B3N0p3e0I082d/Image%202011.07.22%2011:29:25%20PM.png
//
// UIImage *buttonImage = [UIImage ipMaskedImageNamed:@"UIButtonBarAction.png" color:[UIColor redColor]];
// .h
@interface UIImage (IPImageUtils)
+ (UIImage *)ipMaskedImageNamed:(NSString *)name color:(UIColor *)color;
@end
@atnan
atnan / AvailabilityInternal.h
Created May 25, 2011 00:32
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/usr/include/AvailabilityInternal.h
/*
* Copyright (c) 2007-2010 by Apple Inc.. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this
@atnan
atnan / gist:961388
Created May 8, 2011 13:51
Simulate memory warning
- (void)simulateMemoryWarning {
#if TARGET_IPHONE_SIMULATOR
#ifdef DEBUG
CFNotificationCenterPostNotification(CFNotificationCenterGetDarwinNotifyCenter(), (CFStringRef)@"UISimulatedMemoryWarningNotification", NULL, NULL, true);
#endif
#endif
}
i?php
require_once('chorus/Utils.php');
require_once('chorus/Kestrel.php');
require_once('chorus/DataService.php');
require_once('chorus/Shard.php');
Database::set_defaults(array(
'user' => 'tumblr3',
'password' => 'm3MpH1C0Koh39AQD83TFhsBPlOM1Rx9eW55Z8YWStbgTmcgQWJvFt4',
'database' => 'tumblr3',
BOOL isBackgroundingAvailable = (&UIApplicationDidEnterBackgroundNotification != NULL);
if (isBackgroundingAvailable) {
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(applicationWillEnterForegroundNotification:)
name:UIApplicationWillEnterForegroundNotification
object:nil];
}
@atnan
atnan / LongMethodIsLong.h
Created January 11, 2011 04:45
Longest method signature ever?
// From NPR for iPad
-[MedialetsAdEvent initWithEventID:key:time:adID:conn:lat:lon:alt:uCount:uDur:uDict:horizontalAccuracy:verticalAccuracy:urlCounts:adExit:countHr:countDay:countMon:stringValues:numericValues:breadcrumbs:visitedAdEventLinks:durationValues:direction:directionAccuracy:adSlotName:adVersion:adChildAdID:adParentAdID:adIsAClone:]
@atnan
atnan / Foo.h
Created December 23, 2010 04:36
#import "NDVKVOMacros.h"
@implementation Foo
@synthesize bar;
- (id)init {