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
- (NSURLRequest *)connection:(NSURLConnection *)connection willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *)response | |
{ | |
if (response != nil) { | |
[[self client] URLProtocol:self wasRedirectedToRequest:request redirectResponse:response]; | |
} | |
return request; | |
} |
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 <CoreFoundation/CoreFoundation.h> | |
#include <dlfcn.h> | |
static CFBundleRef GetPluginBundle() | |
{ | |
static CFBundleRef bundle; | |
if (bundle) { | |
return bundle; | |
} |
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
NSMutableDictionary *queryParameters = [NSMutableDictionary dictionary]; | |
for (NSString *string in [[URL query] componentsSeparatedByString:@"&"]) { | |
NSArray *array = [string componentsSeparatedByString:@"="]; | |
if ([array count] == 2) | |
[queryParameters setObject:[array objectAtIndex:1] forKey:[array objectAtIndex: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
#include <assert.h> | |
#include <CoreMIDI/CoreMIDI.h> | |
char buffer[1024]; | |
MIDIClientRef client = 0; | |
MIDIEndpointRef endpoint = 0; | |
MIDIPacketList *packetList = (void *)buffer; | |
MIDIPacket *packet = 0; | |
MIDIPortRef port = 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
ffmpeg -loglevel verbose -i input.mkv -acodec copy -vcodec copy output.mp4 |
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
alias bbc6music='open -a "QuickTime Player" $(curl -s http://www.bbc.co.uk/radio/listen/live/r6_aaclca.pls | grep File1= | sed s/File1=//)' |
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
void UIViewRecurse(UIView *view, void (^ apply)(UIView *subview)) | |
{ | |
static void (^ recurse)(UIView *subview, void (^ apply)(UIView *subview)) = nil; | |
if (recurse == nil) | |
recurse = ^(UIView *subview, void (^ apply)(UIView *subview)){ | |
apply(subview); | |
for (UIView *v in subview.subviews) | |
recurse(v, apply); | |
}; | |
recurse(view, apply); |
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/bash | |
set -o errexit | |
set -o pipefail | |
langs=(de es fr pt) | |
for path in en.lproj/*.xib; do | |
git diff --quiet $path && git diff --cached --quiet $path || { | |
echo -n "updating localizations for $path" |
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
NSData *data = [NSData dataWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"embedded" ofType:@"mobileprovision"]]; | |
const char *ptr = [data bytes], *start = NULL, *end = NULL; | |
for (size_t i = 0; i < [data length] - 8; i++) { | |
if (memcmp(ptr + i, "<plist", 6) == 0) { | |
start = ptr + i; | |
} | |
if (memcmp(ptr + i, "</plist>", 8) == 0) { | |
end = ptr + i + 8; | |
} | |
} |
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
# /etc/auto_examples | |
afp_vol -fstype=afp afp://user:password@server/afp_vol | |
smb_vol -fstype=smbfs ://user:password@server/smb_vol | |
#note: no password can be specified for NFS | |
nfs_vol server:/nfs_vol |
OlderNewer