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
extension NSUserDefaults { | |
static func getSavedValue<T>(key: String) -> T? { | |
return NSUserDefaults.standardUserDefaults().objectForKey(key) as? T | |
} | |
static func setSavedValue<T>(value: T, key: String) { | |
NSUserDefaults.standardUserDefaults().setObject(value as? AnyObject, forKey: key) | |
} | |
} | |
/* |
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
extension UIStoryboardSegue { | |
/* | |
Generic way of loading destinationViewController | |
Usage: | |
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { | |
if let controller = segue.destinationController("SegueName", type: CustomController.self) { | |
print(controller) | |
} | |
} | |
*/ |
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
// | |
// UKPostcodeValidator.swift | |
// Medio | |
// | |
// Created by Daniel Tavares on 20/03/2016. | |
// Copyright © 2016 Daniel Tavares. All rights reserved. | |
// References: http://stackoverflow.com/questions/164979/uk-postcode-regex-comprehensive | |
// References: http://benscheirman.com/2014/06/regex-in-swift/ | |
// Usage: UKPostcodeValidator.validate("W1D 5LH") | |
// |
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
// | |
// UILabel+Paragraph.swift | |
// | |
// Created by Daniel Tavares on 09/02/2016. | |
// Copyright © 2016 Daniel Tavares. All rights reserved. | |
// | |
import Foundation | |
//MARK: - Associated Value Struct |
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)vuforiaBugFix | |
{ | |
[AVCaptureVideoDataOutput aspect_hookSelector:@selector(setVideoSettings:) withOptions:AspectPositionInstead usingBlock:^(id<AspectInfo> aspectInfo, NSMutableDictionary *settings) { | |
// lets check if the settings have a PixelFormatType as the key | |
NSString *key = (id)kCVPixelBufferPixelFormatTypeKey; | |
if([settings objectForKey:key]) | |
{ |
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
CGFloat height = 100.f; | |
UIBezierPath *straightPath = [UIBezierPath bezierPath]; | |
[straightPath moveToPoint:CGPointMake(0, 0)]; | |
[straightPath addCurveToPoint:CGPointMake(0, height) controlPoint1:CGPointMake(0, height * 0.5) controlPoint2:CGPointMake(0, height * 0.5)]; | |
UIBezierPath *bendiPath = [UIBezierPath bezierPath]; | |
[bendiPath moveToPoint:CGPointMake(0, 0)]; |
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
// Do any additional setup after loading the view. | |
[[CBTimer instance] startTimerWithMaxTime:5 mode:CBTimerModeDecrease timerDoneBlock:^ (CFTimeInterval elapsed, BOOL isFinished) | |
{ | |
self.counterLabel.text = [NSString stringWithFormat:@"%.3f",elapsed]; | |
if (isFinished) | |
{ | |
UIAlertView *finished =[[UIAlertView alloc] initWithTitle:@"Finished" message:@"Finito" delegate:nil cancelButtonTitle:@"OKAY" otherButtonTitles:nil]; | |
[finished show]; | |
} |
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
+(CAGradientLayer *)layerFromArray:(NSArray *)gradientsArray | |
{ | |
//create gradient from gradient | |
NSMutableArray *arrayOfColors = [NSMutableArray arrayWithCapacity:10]; | |
NSMutableArray *arrayOfPositions = [NSMutableArray arrayWithCapacity:10]; | |
for (NSString *string in gradientsArray) | |
{ | |
NSArray *arr = [string componentsSeparatedByString:@","]; | |
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
# recursively delete original files after a git merge failure | |
find . -name *.orig -delete |
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
// | |
// NSArray_NSArrayUtils.h | |
// GCDAndBlocks | |
// | |
// Created by Daniel Hollis on 21/02/2012. | |
// Copyright (c) 2012 Mobile Interactive Group. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> |