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
if (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_6) { | |
// Use NSOperations | |
} | |
else { | |
// Use GCD | |
} |
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 | |
# | |
# Copyright (c) 2007 Andy Parkins | |
# | |
# An example hook script to mail out commit update information. This hook | |
# sends emails listing new revisions to the repository introduced by the | |
# change being reported. The rule is that (for branch updates) each commit | |
# will appear on one email and one email only. | |
# | |
# This hook is stored in the contrib/hooks directory. Your distribution |
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
You have a stream of bytes in char array buf[]: | |
00 00 00 0A 68 65 6C 6C 6F 77 6F 72 6C 64 | |
You know the bytes follow a protocol with this spec: | |
<1 byte> message type (0 == hello, 1 == goodbye) | |
<3 bytes> message length | |
<N> message content (UTF-8 characters) | |
Determine if this is a hello message, and, if it is, print the content as a string to stdout. |
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
Q: What’s wrong with this code? | |
NSLock* arrayLock = GetArrayLock(); | |
NSMutableArray* myArray = GetSharedArray(); | |
id anObject; | |
[arrayLock lock]; | |
anObject = [myArray objectAtIndex:0]; | |
[arrayLock unlock]; |
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
Funny Tech Tweets | |
================= | |
### Corny ### | |
I know a programming joke about 10,000 mutexes, but it's a bit contentious. | |
--@secboffin | |
I also have a UDP joke. But you might not get it. | |
--@jonathanstray |
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
Obj-C async calls | |
================= | |
Background queue | |
---------------- | |
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ | |
// Do stuff | |
}); |
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
I found this whole file randomly looking through a Terry Pratchett ftp directory on, if I recall, an MIT machine, back in 1995 or 96. I luckily saved a copy, as I haven't been able to find it since... | |
'You know my motto: Forgive and uh... the other thing.' | |
Bus error: passengers dumped | |
COBOL programmers understand why women hate periods. |
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 "ViewController.h" | |
#import <CoreData/CoreData.h> | |
#import "AppDelegate.h" | |
@interface ViewController () | |
@end | |
@implementation ViewController |
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
//: Playground - noun: a place where people can play | |
import UIKit | |
protocol AnyEquatable { | |
func equals(otherObject: AnyEquatable) -> Bool | |
} | |
extension AnyEquatable { | |
func equals(otherObject: AnyEquatable) -> Bool { | |
return false |