Skip to content

Instantly share code, notes, and snippets.

View gist:3548949
// NSNullAdditions.m
// Created by Zach Drayer on 5/7/13.
#import "NSNullAdditions.h"
#define PrintAccessLog \
if (warnsOnNullAccess) { \
zadr / pre-push
Last active Dec 19, 2015
Prevent pushes that break the build.
View pre-push
# 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 +
# Install by adding this file into .git/hooks, naming it `pre-push`
# go into the dir that contains the xcodeproj
cd Foo
# build the xcodeproj for your scheme (and/or configuration)
View gist:6822105
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
@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];
View gist:7569856
#define ZDAssert(me, condition, desc, ...) \
do { \
if (!(condition)) { \
[[NSAssertionHandler currentHandler] handleFailureInMethod:_cmd \
object:me file:[NSString stringWithUTF8String:__FILE__] \
lineNumber:__LINE__ description:(desc), ##__VA_ARGS__]; \
} \
} while(0)
View gist:7592790
@interface MYViewController : UIViewController
@property (atomic, weak) IBOutlet UILabel *readMeLabel;
@implementation MYView
- (void) viewDidLoad {
[super viewDidLoad];
// Technically bad and will generate warnings with
View gist:7744301
@interface BFTBlinkyFunTimesViewController : UIViewController
@property (atomic, strong) UIView *animationView;
@implementation BFTBlinkyFunTimesViewController
- (BOOL) prefersStatusBarHidden {
return YES;
- (void) blink:(CGFloat) delay {
View gist:8144657
diff --git a/otp-standalone/src/main/java/org/opentripplanner/standalone/ b/otp-standalone/src/main/java/org/opentripplanner/standalone/
index 5490d81..2e11751 100644
--- a/otp-standalone/src/main/java/org/opentripplanner/standalone/
+++ b/otp-standalone/src/main/java/org/opentripplanner/standalone/
@@ -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", "", port);
zadr / gist:8410252
Last active May 16, 2020
-[UIView snapshotImage] should totally be an API. But, it isn't, so, here.
View gist:8410252
@interface UIView (za_snapshotting)
- (UIImage *) za_snapshotImage;
@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
int main (int argc, const char **argv) {
NSLog(@"Hello World");
return 0;