Skip to content

Instantly share code, notes, and snippets.

View rsimenok's full-sized avatar

Roman Simenok rsimenok

  • Ukraine, Kyiv
View GitHub Profile
@rsimenok
rsimenok / .gapps-config
Last active December 7, 2017 21:13
My version of Open GApps https://github.com/opengapps/opengapps config file
Include
# Pico+
DialerFramework # Install Dialer Framework
CalSync # Install Google Calendar Sync (except if Google Calendar is being installed)
GoogleTTS # Install Google Text-to-Speech (Micro+ on 5.0-, Pico+ on 6.0+)
PackageInstallerGoogle # Install Google Package Installer
# Nano+
BatteryUsage # Install Device Health Services (7.1+)
@rsimenok
rsimenok / noslashurl.m
Last active March 2, 2016 17:21
Methods to encode and decode URLs to replace "/" and "&".
// Encode a string to embed in an URL.
+(NSString *)encodeString:(NSString *)string {
return CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes(nil, (CFStringRef)string, nil, (CFStringRef)@"!*'();:@&=+$,/?%#[]", kCFStringEncodingUTF8));
}
// Decode a percent escape encoded string.
+(NSString *)decodeString:(NSString *)string {
return CFBridgingRelease(CFURLCreateStringByReplacingPercentEscapesUsingEncoding(nil, (CFStringRef)string, CFSTR(""), kCFStringEncodingUTF8));
}
@rsimenok
rsimenok / defines.h
Last active March 2, 2016 17:22
#define iOS
#define IS_IPAD (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
#define IS_IPHONE (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
#define IS_RETINA ([[UIScreen mainScreen] scale] >= 2.0)
#define SCREEN_WIDTH ([[UIScreen mainScreen] bounds].size.width)
#define SCREEN_HEIGHT ([[UIScreen mainScreen] bounds].size.height)
#define SCREEN_MAX_LENGTH (MAX(SCREEN_WIDTH, SCREEN_HEIGHT))
#define SCREEN_MIN_LENGTH (MIN(SCREEN_WIDTH, SCREEN_HEIGHT))
#define IS_IPHONE_4_OR_LESS (IS_IPHONE && SCREEN_MAX_LENGTH < 568.0)
@rsimenok
rsimenok / childView.m
Last active November 24, 2015 17:39 — forked from tomohisa/gist:2897676
Add and Remove ChildViewController
// add child view
UIViewController* controller = [self.storyboard instantiateViewControllerWithIdentifier:@"test"];
[self addChildViewController:controller];
controller.view.frame = CGRectMake(0, 44, 320, 320);
[self.view addSubview:controller.view];
[controller didMoveToParentViewController:self];
// remove child view
UIViewController *vc = [self.childViewControllers lastObject];
[vc willMoveToParentViewController:nil];