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
// log an object to the browser console | |
console.log({ text: "foobar" }); |
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) runSpinAnimationOnView:(UIView*)view duration:(CGFloat)duration rotations:(CGFloat)rotations repeat:(float)repeat; | |
{ | |
CABasicAnimation* rotationAnimation; | |
rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"]; | |
rotationAnimation.toValue = [NSNumber numberWithFloat: M_PI * 2.0 /* full rotation*/ * rotations * duration ]; | |
rotationAnimation.duration = duration; | |
rotationAnimation.cumulative = YES; | |
rotationAnimation.repeatCount = repeat; | |
[view.layer addAnimation:rotationAnimation forKey:@"rotationAnimation"]; |
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
self.imgeView.image = xxxx; | |
CATransition *transition = [CATransition animation]; | |
transition.duration = 1.0f; | |
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; | |
transition.type = kCATransitionFade; | |
[self.imageView.layer addAnimation:transition forKey:nil]; |
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
[MBProgressHUD showHUDAddedTo:self.view animated:YES]; | |
[MBProgressHUD hideHUDForView:self.view animated:YES]; |
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
+ (SSNetworkDataSource*)sharedDataSource{ | |
static dispatch_once_t pred; | |
static SSNetworkDataSource *obj = nil; | |
dispatch_once(&pred, ^{ | |
obj = [[SSNetworkDataSource alloc]init]; | |
}); | |
return obj; | |
} |
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)requestForSomethingWithComplete:(void (^)(void))completeBlock fail:(void (^)(NSError* error))failBlock; |
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
CGRect windowBounds; | |
if (UIInterfaceOrientationIsLandscape([[UIDevice currentDevice] orientation])) { | |
windowBounds = CGRectMake( 0.0f, 0.0f, [[UIScreen mainScreen]bounds].size.height, [UIScreen mainScreen].bounds.size.width ); | |
}else{ | |
windowBounds = CGRectMake( 0.0f, 0.0f, [[UIScreen mainScreen]bounds].size.width, [UIScreen mainScreen].bounds.size.height ); | |
} |
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)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{ | |
UITouch *touch = [touches anyObject]; | |
CGPoint touchPoint = [touch locationInView:self]; | |
/* if touch point inside the konogram image */ | |
if(CGRectContainsPoint(self.magCoverImageView.frame, touchPoint)){ | |
if(self.delegate!=nil && [self.delegate respondsToSelector:@selector(didClickOnImageForNewIssueCell:)]){ |
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
class HttpClient { | |
typealias completeClosure = ( _ data: Data?, _ error: Error?)->Void | |
func get( url: URL, callback: @escaping completeClosure ) { | |
let request = NSMutableURLRequest(url: url) | |
request.httpMethod = "GET" | |
let task = URLSession.shared.dataTask(with: request) { (data, response, error) in | |
callback(data, error) | |
} | |
task.resume() | |
} |
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
HttpClient().get(url: url) { (success, response) in // Return data } |
OlderNewer