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
#import <Foundation/Foundation.h> | |
#include <grp.h> | |
#include <string.h> | |
#include <sys/stat.h> | |
@interface FileOwnerManager : NSObject | |
- (BOOL)isWheelPresent:(NSString *)path; | |
@end | |
@implementation FileOwnerManager |
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
#import <Foundation/Foundation.h> | |
#import <stdio.h> | |
int main(int argc, char **argv) | |
{ | |
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; | |
NSString *s1 = @"foo"; | |
NSString *s2 = @"foo"; | |
NSString *s3 = [[NSString alloc] initWithString:@"foo"]; |
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
#import <Foundation/Foundation.h> | |
int main(int argc, char **argv) | |
{ | |
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; | |
NSString *json = @"DUMMY({parameters:{code:\"60246\", language:\"en\", country:\"en\"}, result:{\"...JSON...});"; | |
NSUInteger rangeStart = [json rangeOfString:@"result:"].location; | |
NSUInteger lastBrace = [json rangeOfString:@"}" options:NSBackwardsSearch].location; | |
NSUInteger jsonStart = rangeStart + [@"result:" length]; |
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
#import <Foundation/Foundation.h> | |
int main(int argc, char **argv) | |
{ | |
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; | |
NSString *json = @"DUMMY({parameters:{code:\"60246\", language:\"en\", country:\"en\"}, result:{\"...JSON...});"; | |
NSUInteger rangeStart = [json rangeOfString:@"result:"].location; | |
NSString *justJson = [json substringFromIndex:rangeStart + [@"range:" length]]; | |
NSUInteger lastBrace = [justJson rangeOfString:@"}" options:NSBackwardsSearch].location; |
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
#include <stdio.h> | |
struct base { | |
int foo; | |
}; | |
struct derived { | |
int foo; | |
char *bar; | |
}; |
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 bash completion script for Fabric targets | |
# Author: Michael Dippery <mdippery@gmail.com> | |
_complete_fabric() { | |
COMPREPLY=() | |
if [ -e ./fabfile.py ]; then | |
local targets=$(fab -l | sed '1,2d' | awk '{print $1}') | |
local cur="${COMP_WORDS[COMP_CWORD]}" | |
COMPREPLY=( $(compgen -W "${targets}" -- ${cur}) ) | |
fi |
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
#include <stdio.h> | |
#include <string.h> | |
#include <unistd.h> | |
int main(int argc, char **argv) | |
{ | |
int i; | |
fprintf(stderr, | |
" FAIL WHALE! \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
#import <Foundation/Foundation.h> | |
@interface NSObject (NSNullCheck) | |
- (BOOL)isNull; | |
@end | |
@implementation NSObject (NSNullCheck) | |
- (BOOL)isNull { return NO; } | |
@end |
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
// | |
// Created by Michael Dippery on 1/12/2011. | |
// Copyright 2011 Michael Dippery. All rights reserved. | |
// | |
#import "FileTailer.h" | |
@implementation FileTailer | |
- (id)initWithPath:(NSString *)path refreshPeriod:(NSTimeInterval)aRefresh |
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
#import <Foundation/Foundation.h> | |
#include <stdlib.h> | |
#include <stdio.h> | |
#include <string.h> | |
static int compare_char(const char *a, const char *b) | |
{ | |
if (*a > *b) { | |
return 1; | |
} else if (*a < *b) { |