View gist:3548949
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
// | |
// NSNullAdditions.m | |
// | |
// Created by Zach Drayer on 5/7/13. | |
// | |
#import "NSNullAdditions.h" | |
#define PrintAccessLog \ | |
if (warnsOnNullAccess) { \ |
View pre-push
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
# Requires git 1.8.2 or above. This excludes `git` from Xcode 4.6, but should include `git` from Xcode 5 and homebrew. | |
# Not perfect. If you've done anything since your last commit that breaks the build, this will incorrectly fail. Maybe do something like https://twitter.com/drance/status/354365644147392513 + https://twitter.com/cbarrett/status/354372047062835201)? | |
# Install by adding this file into .git/hooks, naming it `pre-push` | |
#!/bin/sh | |
# go into the dir that contains the xcodeproj | |
cd Foo | |
# build the xcodeproj for your scheme (and/or configuration) |
View gist:6822105
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
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce ac | |
ipsum rhoncus, aliquet elit nec, dignissim justo. Maecenas | |
placerat nibh velit, non laoreet urna feugiat sit amet. | |
Pellentesque laoreet ullamcorper dolor, a ultricies lectus | |
mollis eget. Nunc venenatis urna in varius eleifend. Mauris | |
elementum ipsum sed enim adipiscing semper. Aliquam non dolor | |
non velit blandit semper id id dui. Nam in faucibus dolor, quis | |
ullamcorper mi. Integer in purus sed velit consectetur eleifend | |
eget eu augue. Mauris pharetra nisl placerat, porta purus in, | |
consectetur urna. Pellentesque habitant morbi tristique senectus |
View gist:6832979
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 UIImage (ForceLoad2x) | |
// note: fails if you call with @"foo.png", but works fine for @"foo" | |
// can use some NSString methods to get the path extension and fix, if you need to. | |
+ (UIImage *)prefix_forceLoad2xImageNamed:(NSString *)imageNamed { | |
NSString *imageNamed2x = [imageNamed hasSuffix:@"2x"] ?: [imageNamed stringByAppendingString:@"@2x"]; | |
NSString *resourcePath = [[NSBundle mainBundle] pathForResource:imageNamed2x ofType:@"png"]; | |
return [UIImage imageWithContentsOfFile:resourcePath]; | |
} | |
@end |
View gist:7569856
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
#define ZDAssert(me, condition, desc, ...) \ | |
do { \ | |
__PRAGMA_PUSH_NO_EXTRA_ARG_WARNINGS \ | |
if (!(condition)) { \ | |
[[NSAssertionHandler currentHandler] handleFailureInMethod:_cmd \ | |
object:me file:[NSString stringWithUTF8String:__FILE__] \ | |
lineNumber:__LINE__ description:(desc), ##__VA_ARGS__]; \ | |
} \ | |
__PRAGMA_POP_NO_EXTRA_ARG_WARNINGS \ | |
} while(0) |
View gist:7592790
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 MYViewController : UIViewController | |
@property (atomic, weak) IBOutlet UILabel *readMeLabel; | |
@end | |
@implementation MYView | |
- (void) viewDidLoad { | |
[super viewDidLoad]; | |
// Technically bad and will generate warnings with | |
// CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK and CLANG_WARN_OBJC_RECEIVER_WEAK turned on |
View gist:7744301
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 BFTBlinkyFunTimesViewController : UIViewController | |
@property (atomic, strong) UIView *animationView; | |
@end | |
@implementation BFTBlinkyFunTimesViewController | |
- (BOOL) prefersStatusBarHidden { | |
return YES; | |
} | |
- (void) blink:(CGFloat) delay { |
View gist:8144657
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
diff --git a/otp-standalone/src/main/java/org/opentripplanner/standalone/GrizzlyServer.java b/otp-standalone/src/main/java/org/opentripplanner/standalone/GrizzlyServer.java | |
index 5490d81..2e11751 100644 | |
--- a/otp-standalone/src/main/java/org/opentripplanner/standalone/GrizzlyServer.java | |
+++ b/otp-standalone/src/main/java/org/opentripplanner/standalone/GrizzlyServer.java | |
@@ -41,7 +41,7 @@ public class GrizzlyServer { | |
// Rather than use Jersey's GrizzlyServerFactory we will construct one manually, so we can | |
// set the number of threads, etc. | |
HttpServer httpServer = new HttpServer(); | |
- NetworkListener networkListener = new NetworkListener("sample-listener", "localhost", port); | |
+ NetworkListener networkListener = new NetworkListener("sample-listener", "0.0.0.0", port); |
View gist:8410252
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 UIView (za_snapshotting) | |
- (UIImage *) za_snapshotImage; | |
@end | |
@implementation UIView (za_snapshotting) | |
- (UIImage *) za_snapshotImage { | |
UIGraphicsBeginImageContextWithOptions(self.bounds.size, self.opaque, self.window.screen.scale); | |
[self drawViewHierarchyInRect:self.bounds afterScreenUpdates:YES]; |
View gist:9013930
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
int main (int argc, const char **argv) { | |
NSLog(@"Hello World"); | |
return 0; | |
} |
OlderNewer