Skip to content

Instantly share code, notes, and snippets.

Yuriy Tolstoguzov yuriy-tolstoguzov

Block or report user

Report or block yuriy-tolstoguzov

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@drance
drance / gist:9613950
Last active Aug 29, 2015
Got tired of semaphore/runloop boilerplate for async unit tests
View gist:9613950
- (void)sleepRunLoopForInterval:(NSTimeInterval)interval whileRunningAsynchronousTest:(void (^)(dispatch_semaphore_t semaphore))test {
dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);
NSAssert((test != NULL), @"Passed a NULL test block");
test(semaphore);
while(dispatch_semaphore_wait(semaphore, DISPATCH_TIME_NOW)) {
[[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:interval]];
}
}
@matthiasplappert
matthiasplappert / gist:9493050
Last active Aug 29, 2015
QuickLook Debugging for `UIView`
View gist:9493050
@interface UIView (MPAdditions)
@end
@implementation UIView (MPAdditions)
- (id)debugQuickLookObject {
if (self.bounds.size.width < 0.0f || self.bounds.size.height < 0.0f) {
return nil;
}
@kylefox
kylefox / color.m
Created Jan 27, 2012
Generate a random color (UIColor) in Objective-C
View color.m
/*
Distributed under The MIT License:
http://opensource.org/licenses/mit-license.php
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
You can’t perform that action at this time.