Skip to content

Instantly share code, notes, and snippets.

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
vikage / backupDSYM.sh
Last active October 7, 2016 08:26
Backup DSYM file to Desktop after build **Include to xcode run script - Build pharses**
View backupDSYM.sh
DSYM_UDID="$(xcrun dwarfdump --uuid ${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH} | cut -c 7-42)"
DSYM_LOCATE=${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}
DSYM_BACKUP_FOLDER="$HOME/Desktop/DSYM/${TARGET_NAME}"
mkdir -p $DSYM_BACKUP_FOLDER
DSYM_BACKUP_LOCATE="$DSYM_BACKUP_FOLDER/$DSYM_UDID.DSYM"
if [ ! -e "$DSYM_BACKUP_LOCATE" ]; then
echo "DSYM Backup File not found!... Copying"
cp -r "$DSYM_LOCATE" "$DSYM_BACKUP_LOCATE"
fi
@vikage
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
@vikage
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
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
#!/bin/bash
BUILD_CONFIG="Release"
SCHEME=""
FILENAME="xxx"
while getopts m:s:f:h aflag; do
case $aflag in
m) BUILD_CONFIG=$OPTARG;;
s) SCHEME=$OPTARG;;
f) FILENAME=$OPTARG;;
@vikage
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
vikage / clean_code.md
Created June 10, 2017 15:49 — forked from wojteklu/clean_code.md
Summary of 'Clean code' by Robert C. Martin
View clean_code.md

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",
UIFontDescriptorCascadeListAttribute:
@[
[UIFontDescriptor fontDescriptorWithFontAttributes:@{ UIFontDescriptorNameAttribute: @"Hiragino Sans GB W3" }]
]
}];
});
UIFont *font = [UIFont fontWithDescriptor:fontDescriptor size:pointSize];
@vikage
vikage / main.s
Last active February 19, 2020 07:51
[ASM] Input number and print sequence from 1 to number
View main.s
.intel_syntax noprefix
.globl _main
.data
L.str.input:
.asciz "Input number: "
L.str.input_pattern:
.asciz "%d"
L.str.output_pattern:
.asciz "%d "
L.str.output:
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)