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, const char **argv) { | |
@autoreleasepool { | |
NSMutableArray *mutableArray; | |
NSString *str = @"one two three"; | |
mutableArray = [[str componentsSeparatedByString:@" "] copy]; | |
[mutableArray addObject:@"four"]; | |
for (NSString *s in mutableArray) { | |
NSLog(@"%@", s); |
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
$ cat locktest.m | |
#import <Foundation/Foundation.h> | |
@interface Locker : NSObject { | |
NSRecursiveLock *_lock; | |
} | |
- (void)setLock:(NSRecursiveLock *)lock; | |
@end | |
@implementation Locker |
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> | |
static void nextMonth(NSDateComponents *comps) { | |
NSInteger month = [comps month]; | |
if (month == 12) { | |
[comps setYear:[comps year] + 1]; | |
[comps setMonth:1]; | |
} else { | |
[comps setMonth:month + 1]; | |
} |
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 ClassA : NSObject | |
@property NSMutableString *string; | |
- (void)changeString; | |
- (void)printString; | |
@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
2014-01-21 14:57:39.317 getifaddrs[31705:707] name=lo0, family=30, address=fe80::1 | |
2014-01-21 14:57:39.319 getifaddrs[31705:707] name=lo0, family=2, address=127.0.0.1 | |
2014-01-21 14:57:39.319 getifaddrs[31705:707] name=lo0, family=30, address=::1 | |
2014-01-21 14:57:39.320 getifaddrs[31705:707] name=en1, family=30, address=fe80::fa1a:67ff:fe0e:30eb | |
2014-01-21 14:57:39.320 getifaddrs[31705:707] name=en1, family=2, address=192.168.1.100 |
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
$ clang -DDEBUG=1 -g -fobjc-arc -o rlsleep rlsleep.m -framework Foundation | |
$ ./rlsleep | |
2014-02-20 11:45:36.481 rlsleep[95410:707] Before 2014-02-20 11:45:36 +0000 | |
2014-02-20 11:45:37.475 rlsleep[95410:707] Tick | |
2014-02-20 11:45:38.476 rlsleep[95410:707] Tick | |
2014-02-20 11:45:39.475 rlsleep[95410:707] Tick | |
2014-02-20 11:45:40.475 rlsleep[95410:707] Tick | |
2014-02-20 11:45:41.475 rlsleep[95410:707] Tick | |
2014-02-20 11:45:42.476 rlsleep[95410:707] Tick | |
2014-02-20 11:45:43.476 rlsleep[95410:707] Tick |
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
#!/usr/bin/env python | |
# | |
# Slice an image into the specified number of vertical slices. | |
# | |
# Usage: vslice.py [options] image output-path num-slices | |
# Use --help for a list of options. | |
# | |
# Andy Duplain <[email protected]> 26-Feb-2014 | |
# |
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 <CoreServices/CoreServices.h> | |
int main(int argc, const char **argv) | |
{ | |
@autoreleasepool { | |
for (int i = 1; i < argc; i++) { | |
char *endp; | |
long value = strtol(argv[i], &endp, 10); | |
if (*endp == '\0') { |
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
--- Source/cpptinkering ‹master*➔ ?› » make | |
clang++ -DDEBUG=1 -g -Wall -std=c++11 -stdlib=libc++ -o setcwd setcwd.cpp -lstdc++ | |
--- Source/cpptinkering ‹master*➔ ?› » ./setcwd | |
Changing to directory '.' | |
This is a one. | |
This is line two. | |
This is line three. | |
--- Source/cpptinkering ‹master*➔ ?› » cd / | |
--- / » /Users/andy/Source/cpptinkering/setcwd | |
Changing to directory '/Users/andy/Source/cpptinkering' |
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 | |
dobuild=1 | |
docopy=1 | |
doclean=1 | |
version=1.6.9 | |
srcdir=libpng-${version} | |
srcfile=${srcdir}.tar.gz | |
srctarball=http://sourceforge.net/projects/libpng/files/libpng16/${version}/${srcfile}/download | |
outdir=$(cd ../external-deps/png; pwd) |
OlderNewer