Skip to content

Instantly share code, notes, and snippets.

vikage /
Last active October 7, 2016 08:26
Backup DSYM file to Desktop after build **Include to xcode run script - Build pharses**
DSYM_UDID="$(xcrun dwarfdump --uuid ${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH} | cut -c 7-42)"
if [ ! -e "$DSYM_BACKUP_LOCATE" ]; then
echo "DSYM Backup File not found!... Copying"
vikage / gist:c2019c600da4aafa3b49946a68e9ae8c
Created November 16, 2016 08:04 — forked from XueshiQiao/gist:5918651
Disable warning "PerformSelector may cause a leak because its selector is unknown"
View gist:c2019c600da4aafa3b49946a68e9ae8c
//disable warning:"PerformSelector may cause a leak because its selector is unknown"
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
[self.delegate performSelector:self.selector];
#pragma clang diagnostic pop
View Change cancel button UIImagePicker.m
-(void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated
for (UIView *v in viewController.view.subviews)
NSLog(@"%@",[v class]);
if ([v isKindOfClass:[NSClassFromString(@"CMKBottomBar") class]])
SEL se = NSSelectorFromString(@"cancelButton");
// method
vikage / xxx.m
Last active February 27, 2017 06:25
Fix UIImagePickerController allowEditing bug
View xxx.m
@implementation UpdateAvatarViewController
UIScrollView *cropImageScrollView;
-(void) chooseCameraPicture
cropImageScrollView = nil;
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
vikage / xbuild
Created May 15, 2017 14:48
xbuild script to build project iOS. Put it to /usr/bin and call from current project command line. xbuild -h for more.
View xbuild
while getopts m:s:f:h aflag; do
case $aflag in
vikage / .bash_profile
Created May 17, 2017 02:28 — forked from natelandau/.bash_profile
Mac OSX Bash Profile
View .bash_profile
# ---------------------------------------------------------------------------
# Description: This file holds all my BASH configurations and aliases
# Sections:
# 1. Environment Configuration
# 2. Make Terminal Better (remapping defaults and adding functionality)
# 3. File and Folder Management
# 4. Searching
# 5. Process Management
vikage /
Created June 10, 2017 15:49 — forked from wojteklu/
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.

General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

View gist:83c027dcabcbe9116fdf830b685d037b
UIFontDescriptor *fontDescriptor = [UIFontDescriptor fontDescriptorWithFontAttributes:@{
UIFontDescriptorNameAttribute: @"SourceSansPro-Regular",
[UIFontDescriptor fontDescriptorWithFontAttributes:@{ UIFontDescriptorNameAttribute: @"Hiragino Sans GB W3" }]
UIFont *font = [UIFont fontWithDescriptor:fontDescriptor size:pointSize];
View isa_analysis.c
#import <Foundation/Foundation.h>
#import <objc/runtime.h>
int main() {
// extra_rc must be the MSB-most field (so it matches carry/overflow flags)
// indexed must be the LSB (fixme or get rid of it)
View HelloService.getValue.c
void * -[HelloService getValue](void * self, void * _cmd) {
var_18 = [@"Hello" retain];
var_28 = [var_18 retain];
objc_storeStrong(var_18, 0x0);
rax = [var_28 autorelease];
return rax;