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
/// | |
/// Author : Gaurav D. Sharma | |
/// Run on Swift 3.0 | |
/// IBM swift sandbox : https://swiftlang.ng.bluemix.net/#/repl | |
/// | |
//// Are you using ObjectMapper for model mapping in swift. | |
//// Object creation like Mapper<T>().map(jsonString) | |
//// And you are irritaed with the type name passing and syntex memorization | |
//// |
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)renderRect:(UIView*)imgView { | |
UIBezierPath *path = [UIBezierPath bezierPathWithRect:imgView.bounds]; | |
return path.CGPath; | |
} | |
- (CGPathRef)renderTrapezoid:(UIView*)imgView { | |
CGSize size = imgView.bounds.size; | |
UIBezierPath *path = [UIBezierPath bezierPath]; | |
[path moveToPoint:CGPointMake(size.width * 0.33f, size.height * 0.66f)]; |
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)setMaskImage { | |
CALayer *mask = [CALayer layer]; | |
mask.contents = (id)[[UIImage imageNamed:@"infoLogo"] CGImage]; | |
mask.frame = self.imgItem.bounds; | |
self.imgItem.layer.mask = mask; | |
self.imgItem.layer.masksToBounds = YES; | |
self.imgItem.contentMode = UIViewContentModeCenter; | |
} |
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
#define Header_height 30 | |
- (void)scrollViewDidScroll:(UIScrollView *)scrollView { | |
for (UITableViewCell *cell in self.tblRedeemables.visibleCells) { | |
CGFloat hiddenFrameHeight = scrollView.contentOffset.y + Header_height - cell.frame.origin.y; | |
if (hiddenFrameHeight >= 0 || hiddenFrameHeight <= cell.frame.size.height) { | |
[self maskCell:cell | |
fromTopWithMargin:hiddenFrameHeight]; | |
} | |
} |
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
const checkForceUpdate = (serverVersion, localVersion) => { | |
const strServerVersion = serverVersion.replace(/\./g, ''); | |
const strLocalVersion = localVersion.replace(/\./g, ''); | |
const power = | |
Math.max(strServerVersion.length, strLocalVersion.length) - | |
Math.min(strServerVersion.length, strLocalVersion.length); | |
let numServer = parseInt(strServerVersion); | |
let numLocal = parseInt(strLocalVersion); | |
if (strServerVersion.length < strLocalVersion.length) { |
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
#chmod +x <fileName> | |
#!/bin/bash | |
# Add this file on you desktop folder | |
read -p '[Enter AppName:] ' appName | |
# - Create a folder | |
mkdir "$appName" | |
# - Move to the same folder | |
cd "$appName" |