View XCTestCase-RLWaitWithExpectation.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
#import <XCTest/XCTest.h> | |
@interface XCTestCase (RLWaitWithExpectation) | |
- (void)waitFor:(NSTimeInterval)seconds withExpectationBlock:(BOOL (^)())block; | |
@end | |
@implementation XCTestCase (RLWaitWithExpectation) |
View RLCrashyView.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
// | |
// RLCrashyView.m | |
// CrashyMcCrashy | |
// | |
// Created by brian on 10/31/13. | |
// Copyright (c) 2013 Rantlab. All rights reserved. | |
// | |
#import <Cocoa/Cocoa.h> |
View RLArrowView.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
// | |
// RLArrowView.m | |
// | |
// Created by brian on 6/20/13. | |
// Copyright (c) 2013 RantLab. All rights reserved. | |
// | |
#import "RLArrowView.h" | |
@implementation RLArrowView |
View gist:5851387
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)wiggleFromPath:(CGPathRef)path target:(CGPoint)target amount:(CGFloat)amount | |
{ | |
CGPoint middle = CGPointMake(CGRectGetMidX(self.bounds), CGRectGetMidY(self.bounds)); | |
CGPathRef endPath = [RLArrowView createPathWithArrowFromPoint:middle | |
toPoint:target | |
tailWidth:2.0 | |
headWidth:10.0 | |
headLength:20.0 | |
wiggle:amount]; |
View gist:5851365
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
CGPathRef endPath = [RLArrowView createPathWithArrowFromPoint:middle | |
toPoint:target | |
tailWidth:2.0 | |
headWidth:10.0 | |
headLength:20.0 | |
wiggle:0]; | |
[NSAnimationContext runAnimationGroup:^(NSAnimationContext *context){ | |
View gist:5851343
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)mouseDown:(NSEvent *)event | |
{ | |
arrow = [CAShapeLayer layer]; | |
CGFloat minMagnitude = 20; | |
CGPoint middle = CGPointMake(CGRectGetMidX(self.bounds), CGRectGetMidY(self.bounds)); | |
CGPoint vector = CGPointMake(target.x-middle.x, target.y-middle.y); | |
CGFloat magnitude = sqrt(vector.x*vector.x+vector.y*vector.y); | |
CGPoint start = CGPointMake(middle.x+vector.x/magnitude*minMagnitude, middle.y+vector.y/magnitude*minMagnitude); | |
View gist:5851290
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
+ (CGPathRef )createPathWithArrowFromPoint:(CGPoint)startPoint | |
toPoint:(CGPoint)endPoint | |
tailWidth:(CGFloat)tailWidth | |
headWidth:(CGFloat)headWidth | |
headLength:(CGFloat)headLength | |
wiggle:(CGFloat)wiggle | |
{ | |
CGFloat length = hypotf(endPoint.x - startPoint.x, endPoint.y - startPoint.y); | |
CGPoint points[9]; |
View NSObject+BlockObservation.h
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
// | |
// NSObject+BlockObservation.h | |
// Version 1.0 | |
// | |
// Andy Matuschak | |
// andy@andymatuschak.org | |
// Public domain because I love you. Let me know how you use it. | |
// | |
#import <Cocoa/Cocoa.h> |
NewerOlder