Skip to content

Instantly share code, notes, and snippets.

View HeidiHansen's full-sized avatar
🚲

JungleDev HeidiHansen

🚲
View GitHub Profile
@HeidiHansen
HeidiHansen / ArrayMethods
Created October 5, 2014 00:41
Playing With Array methods.
#import "Collections.h"
@implementation Collections
//sorts the array in ascending order
-(NSArray *)sortArrayAsc:(NSArray *)array
{
return [array sortedArrayUsingSelector:@selector(compare:)];
}
@HeidiHansen
HeidiHansen / PlayingCardDeckInit
Last active August 29, 2015 14:07
Playing Card Deck
- (instancetype)init
{
self = [super init];
self.cards = [[NSMutableArray alloc] init];
NSArray *suits = @[@"♣",@"♥",@"♦",@"♠"];
for (NSInteger i=0; i<4; i++){
for (NSInteger j=0; j<13; j++){
@HeidiHansen
HeidiHansen / FizzBuzz
Created October 4, 2014 22:33
FizzBuzz
- (NSArray *)getValuesBetweenNumber:(NSNumber *)startNumber andNumber:(NSNumber *)endNumber
{
for (NSInteger i = [startNumber integerValue]; i <= [endNumber integerValue]; i++)
{
[self.fizzBuzzArray addObject:@(i)];
}
NSString *fizz = @"Fizz ";
NSString *buzz = @"Buzz ";
NSString *fizzBuzz = @"FizzBuzz ";
@HeidiHansen
HeidiHansen / testingBasics
Created October 4, 2014 22:19
Specta/Expecta testing - basic
#import "Specta.h"
#define EXP_SHORTHAND
#import "Expecta.h"
#import "KIF.h"
#import "Swizzlean.h"
SpecBegin(GenericTestSpec)
describe(@"GenericTestSpec", ^{
@HeidiHansen
HeidiHansen / THConversationShareViewController.m
Last active August 29, 2015 14:06
12. in TH's THConversationShareViewController.m, starting at line 222
- (void)doPreviewImageGesture:(UIGestureRecognizer *)gesture {
if (gesture.state != UIGestureRecognizerStateRecognized) {
return;
}
if ([THFeature isOn:kTHFeatureImageShareEdit]) {
[[Mixpanel sharedInstance] track:@"Share Image Preview Tapped"];
}
[self.conversationShareView.textView resignFirstResponder];
@HeidiHansen
HeidiHansen / 11. THCameraViewController.m
Created September 16, 2014 20:35
11. THCameraViewController.m
#import "THCameraViewController.h"
#import "THCameraButton.h"
#define DegreesToRadians(x) ((x) * M_PI / 180.0)
@interface THCameraViewController ()
@property (strong, nonatomic) UIView *videoPreview;
//@property (nonatomic) CGFloat videoPreviewWidth;
@HeidiHansen
HeidiHansen / 10. THCameraViewController.h
Created September 16, 2014 20:28
10. THCameraViewController.h
#import <UIKit/UIKit.h>
#import <AVFoundation/AVFoundation.h>
#import "THCameraButton.h"
@protocol THCameraDelegateProtocol <NSObject>
-(void)takePhotoTapped:(UIImage *)image;
@end
@HeidiHansen
HeidiHansen / 09. THTextOverlay.h
Created September 16, 2014 20:26
09. THTextOverlay.h
#import <Foundation/Foundation.h>
@interface THTextOverlay : UIView
@property (strong, nonatomic) NSString *imageText;
@property (nonatomic) CGFloat textSize;
@property (strong, nonatomic) UIFont *font;
@property (nonatomic) CGRect viewFrameToDrawIn;
@property (nonatomic) NSTextAlignment textAlignment;
@HeidiHansen
HeidiHansen / 08. THTextOverlay.m
Created September 16, 2014 20:24
08. THTextOverlay.m
#import "THTextOverlay.h"
@implementation THTextOverlay
-(instancetype)init
{
return [self initWithImageText:@"DEFAULT TEXT"
Font:[UIFont systemFontOfSize:20]
FontSize:20
TextAlignment:NSTextAlignmentLeft
@HeidiHansen
HeidiHansen / 07. THEditImageViewController+AutoLayout.h
Created September 16, 2014 20:22
07. THEditImageViewController+AutoLayout.h
#import "THEditImageViewController.h"
@interface THEditImageViewController (Autolayout)
- (void)layoutCamera;
- (void)layoutToolbarOfStandardHeight;
- (void)animateLayoutToolbarOfHeightZeroAtBottomOfScreenWithCompletion:(void (^)(void))completionBlock;
- (void)animateLayoutToolbarOfStandardHeightWithCompletion:(void (^)(void))completionBlock;
- (void)removeAllTopLevelViewConstraints;
- (void)removeSubviewConstraints;