Skip to content

Instantly share code, notes, and snippets.

@CocoaRush
CocoaRush / martini.m
Created February 18, 2014 03:14
a Martini shape created for UIBezierPath, best shaped with a frame that have the same width and height.
+ (UIBezierPath *)martiniShape:(CGRect)originalFrame {
float x = CGRectGetMinX(originalFrame);
float y = CGRectGetMinY(originalFrame);
float width = CGRectGetWidth(originalFrame);
float height = CGRectGetHeight(originalFrame);
UIBezierPath* bezierPath = [UIBezierPath bezierPath];
[bezierPath moveToPoint: CGPointMake(x + 0.33980 * width, y + 0.99174 * height)];
[bezierPath addCurveToPoint: CGPointMake(x + 0.35471 * width, y + 0.98285 * height) controlPoint1: CGPointMake(x + 0.34475 * width, y + 0.98872 * height) controlPoint2: CGPointMake(x + 0.34935 * width, y + 0.98462 * height)];
[bezierPath addCurveToPoint: CGPointMake(x + 0.46691 * width, y + 0.94635 * height) controlPoint1: CGPointMake(x + 0.39206 * width, y + 0.97052 * height) controlPoint2: CGPointMake(x + 0.42994 * width, y + 0.95972 * height)];
@CocoaRush
CocoaRush / hideStatusBar.m
Last active December 21, 2015 20:29 — forked from Marlunes/hide_status_bar
hide status bar on iOS 7, add this snippet on the root view controller.
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
if ([self respondsToSelector:SELE(setNeedsStatusBarAppearanceUpdate)]) { //iOS 7
[self setNeedsStatusBarAppearanceUpdate];
} else {
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationFade];
}
@CocoaRush
CocoaRush / Sudoku.py
Last active December 21, 2015 06:39
Sudoku solution
#python
#这是一句中文
@CocoaRush
CocoaRush / re
Last active December 14, 2021 18:12
unzip a zip file using Python. The zip may created in Win OS and would have a lot of gibberish in file name when unzipped in MAC OS, this simple snippet aim to solved the above problem stated.
sfgsg