Skip to content

Instantly share code, notes, and snippets.

View yoterpa's full-sized avatar

Anish Chand yoterpa

  • Srijan
  • New Delhi, India
View GitHub Profile
@yoterpa
yoterpa / UIBarButtonFromCode.m
Created May 13, 2015 06:39
add toolbar and center toolbar buttons from code
UIBarButtonItem *flexibleSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
UIBarButtonItem *item1 = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonItemStylePlain target:self action:@selector(item1Action:)];
UIBarButtonItem *item2 = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonItemStylePlain target:self action:@selector(item2Action:)];
NSArray *toolbarItems = [NSArray arrayWithObjects:item1, flexibleSpace, item2];
[toolBar setItems:toolbarItems animated:NO];

UIViewController's method invoke sequence is as below

  • awakeFromNib
  • viewDidLoad
  • viewWillAppear
  • viewWillLayoutSubviews
  • viewDidLayoutSubviews
  • viewDidAppear
@yoterpa
yoterpa / images_ios_workaround.md
Created March 25, 2015 19:32
Xcode 6.1 using same 2x image for iPhone 6 and 4s simulator

best approach is the old-fashioned way. Create images for each size with names like test-667 and do something like:

[UIImage imageNamed:[NSString stringWithFormat:@"test-%g", [[UIScreen mainScreen] bounds].size.height]]
@yoterpa
yoterpa / create_ipa_file_xcode.md
Last active August 29, 2015 14:17
How to create IPA in Xcode 6?
  1. Select your Project Target in your xcode, then select Product option, in which you could select Archive option.
  2. Then a new window would open up and in that window select the Export option.
  3. Then a pop up will come as below and select second option Save to ad-hoc deployment.
@yoterpa
yoterpa / iphone_images_universal.md
Created March 25, 2015 17:47
How to support both iPad and iPhone retina graphics in universal apps

for devices without retina:

ImageName.png - For iPhone/iPod
ImageName~ipad.png -- For iPad

For devices with retina display:

[email protected] - For iPhone/iPod
ImageName@2x~ipad.png -- For iPad
@yoterpa
yoterpa / CATransition_types.m
Created March 17, 2015 06:29
Available CATransition types
kCATransitionFade
kCATransitionMoveIn
kCATransitionPush
kCATransitionReveal
@"cameraIris"
@"cameraIrisHollowOpen"
@"cameraIrisHollowClose"
@"cube"
@"alignedCube"
@"flip"
RewriteEngine on
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^quote-flow https://%{HTTP_HOST}/quote-flow [R=301,L]
@yoterpa
yoterpa / github_ssh-key.md
Created February 24, 2015 06:11
ssh-key generation, github.com, linux
https://help.github.com/articles/generating-ssh-keys/#platform-linux

sign up for a new relic account first and you'd get the license key on your account page.

sudo sh -c 'echo deb http://apt.newrelic.com/debian/ newrelic non-free >> /etc/apt/sources.list.d/newrelic.list'

sudo wget -O- https://download.newrelic.com/548C16BF.gpg | sudo apt-key add -

sudo apt-get update

sudo apt-get install newrelic-sysmond