View url-builder.m
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
NSURL *someURL = [NSURL URLWithBuilderBlock:^(NSURLComponents *builder) { | |
builder.scheme = @"http"; | |
builder.host = @"joris.kluivers.nl"; | |
builder.path = @"/blog/2013/10/17/nsurlcomponents/"; | |
}]; | |
// url now equals: | |
// http://joris.kluivers.nl/blog/2013/10/17/nsurlcomponents/ |
View gist:9808519
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
@implementation UIResponder (ResponderForwarding) | |
- (BOOL) tryToPerformAction:(SEL)action withObject:(id)object | |
@end | |
@implementation UIResponder (ResponderForwarding) | |
- (BOOL) tryToPerformAction:(SEL)action withObject:(id)object | |
{ | |
if (!action) { | |
return NO; |
View gist:7698470
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 <sys/types.h> | |
#include <sys/sysctl.h> | |
#if TARGET_OS_IPHONE | |
char *propertyName = "hw.machine"; | |
#else | |
char *propertyName = "hw.model"; | |
#endif | |
size_t size; |
View gist:7023579
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
// See also my related blog post: | |
// http://joris.kluivers.nl/blog/2013/10/17/nsurlcomponents/ | |
NS_CLASS_AVAILABLE(10_9, 7_0) | |
@interface NSURLComponents : NSObject <NSCopying> | |
// Initialize a NSURLComponents with all components undefined. Designated initializer. | |
- (id)init; | |
// Initialize a NSURLComponents with the components of a URL. If resolvingAgainstBaseURL is YES and url is a relative URL, the components of [url absoluteURL] are used. If the url string from the NSURL is malformed, nil is returned. |
View gist:4388037
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
@interface NSTableCellView (JKNibLoading) | |
+ (instancetype) tableCellViewWithNibNamed:(NSString *)nibName owner:(id)owner; | |
@end | |
@implementation NSTableCellView (JKNibLoading) | |
+ (instancetype) tableCellViewWithNibNamed:(NSString *)nibName owner:(id)owner | |
{ | |
NSTableCellView *view = nil; | |
NSArray * topLevelObjects = nil; |
View gist:3878391
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
ssh host.com 'cd /var/www/; git pull' |
View gist:3781049
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
uuidgen | tr -d '\n' | pbcopy |
View gist:2775861
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
NSArray *fileURLs = [NSArray arrayWithObjects:fileURL1, /* ... */ nil]; | |
[[NSWorkspace sharedWorkspace] activateFileViewerSelectingURLs:fileURLs]; |
View BuildRule.sh
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
# Template file with replacement tag: ${BODY} | |
TEMPLATE="${SRCROOT}/ShapeDemo/Template.html" | |
# generate and clean HTML | |
HTML_CONTENTS=`/usr/local/bin/markdown "${INPUT_FILE_PATH}"` | |
HTML_CONTENTS=`echo $HTML_CONTENTS | sed -e 's/[\/&]/\\\&/g'` | |
# replace into template and write to Resources | |
cat "$TEMPLATE" | sed "s/\${BODY}/${HTML_CONTENTS}/" > "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/${INPUT_FILE_BASE}.html" |
View AppLock.mobileconfig.xml
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>PayloadContent</key> | |
<array> | |
<dict> | |
<key>PayloadDescription</key> | |
<string>Disables the home button.</string> | |
<key>PayloadDisplayName</key> |
NewerOlder