Monday, 22 August 2016

Install GitLab 5.3 on Mac OS X server 10.8.4

Below are the steps to install GitLab 5.3 on a fresh Mac OS X server 10.8.4 (server version 2.2)
1) Install a fresh mac ox x 10.8.4
2) Create user group “git” and a user “git” in this group
3) Enable remote login for “git” user
4) Install Xcode 4.6.2
5) Install command line tools in Xcode.
6) Install Home brew

Tuesday, 2 August 2016

ImagePicker in iOS 8+ (objective-c)

Here is the Rocket repo for the image picker and simple code for open actionsheet.
[[ImagePicker sharedPicker] imagePickerOnViewController:self
                                                   withSize:CGSizeMake(150, 150)
                                                   andImage:^(UIImage *img) {
                                                       if (img) {
                                                           self.imgView.image = img;
                                                       } else {
                                                           NSLog(@"Image not available");
                                                       }
                                                   }];



Wednesday, 15 June 2016

Creating HMAC in postman using CryptoJS

Place this script at pre-request-script and environment.secret is stored in environment variables or pass hardcoded here.
It will convert HMAC(.SHA256, /URI + /Body) and place into a global variable name as signature. which can pass on header like: x-pch-digest:{{signature}}

var index = request.url.indexOf('/');
var uri_path = request.url.substring(index);
var payload = uri_path + request.data;
console.log("Using payload as " + payload)
var hash = CryptoJS.HmacSHA256(payload, environment.secret);
var hashInBase64 = CryptoJS.enc.Hex.stringify(hash);
postman.setGlobalVariable("signature", hashInBase64);


Code signing using terminal

codesign --verify --force --sign "$CODE_SIGN_IDENTITY" "$CODESIGNING_FOLDER_PATH"
Walk through : http://stackoverflow.com/questions/20344255/secitemadd-and-secitemcopymatching-returns-error-code-34018-errsecmissingentit/22305193#22305193

Find UIViewController of the UIView in objective-c [Backtracking]

@interface UIView(UIViewControllerFinder)

- (UIViewController*)viewController;

@end


@implementation UIView(UIViewControllerFinder)

- (UIViewController*)viewController {
    for (UIView* next = [self superview]; next; next = next.superview) {
        UIResponder* nextResponder = [next nextResponder];
        if ([nextResponder isKindOfClass:[UIViewController class]]) {
            return (UIViewController*)nextResponder;
        }
    }
    return nil;
}

@end

Try this code for find view-controller of view self.btnSubmit (UIButton) or any object inherits from UIView
UIViewController *vc = [self.btnSubmit viewController];

Sunday, 24 April 2016

Bulk task in one script using selenium (python) : Web automation


Hey I want create crash web hook for my 100 apps hosted on hockeyApp and I'm programmer so I cannot do it manually fill that form 100 times the same data for different apps, no public API provided by hockeyApp, so I wrote some python code using selenium tool for this task and voila, I feel I'm programmer.

Here is the codes