- You have a VM with small disk
- You have GPT partition table
- You NOT USE LVM (you should)
- You need to extend a partition on the main drive
- You use Debian 8.x aka Jessie
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
/* | |
If you use Storyboard, don't forget to set UIlabel to PaddingLabel | |
*/ | |
import UIKit | |
class PaddingLabel: UILabel { | |
var topInset: CGFloat | |
var bottomInset: CGFloat |
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
// color - source color, which is must be replaced | |
// withColor - target color | |
// tolerance - value in range from 0 to 1 | |
func replaceColor(color:SKColor, withColor:SKColor, image:UIImage, tolerance:CGFloat) -> UIImage{ | |
// This function expects to get source color(color which is supposed to be replaced) | |
// and target color in RGBA color space, hence we expect to get 4 color components: r, g, b, a | |
assert(CGColorGetNumberOfComponents(color.CGColor) == 4 && CGColorGetNumberOfComponents(withColor.CGColor) == 4, | |
"Must be RGBA colorspace") |
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)rotatePath:(UIBezierPath *)path degree:(CGFloat)degree { | |
CGRect bounds = CGPathGetBoundingBox(path.CGPath); | |
CGPoint center = CGPointMake(CGRectGetMidX(bounds), CGRectGetMidY(bounds)); | |
CGFloat radians = (degree / 180.0f * M_PI); | |
CGAffineTransform transform = CGAffineTransformIdentity; | |
transform = CGAffineTransformTranslate(transform, center.x, center.y); | |
transform = CGAffineTransformRotate(transform, radians); | |
transform = CGAffineTransformTranslate(transform, -center.x, -center.y); | |
[path applyTransform:transform]; |