This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Source: | |
# https://stackoverflow.com/questions/3971822/how-do-i-validate-my-yaml-file-from-command-line | |
$ ruby -e "require 'yaml';puts YAML.load_file('some-file.yaml')" | |
$ perl -MYAML -e 'use YAML;YAML::LoadFile("./file.yaml")' | |
$ python -c "from yaml import load, Loader; load(open('.travis.yml'), Loader=Loader)" | |
$ travis lint .travis.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UISwitch * uis = [[[UISwitch alloc] init] autorelease]; | |
[uis addTarget:self action:@selector(toogleSwitch:) forControlEvents:UIControlEventValueChanged]; | |
NSString * key = [[sets objectAtIndex:[indexPath section]] objectForKey:SOME_KEY]; | |
uis.on = [[[NSUserDefaults standardUserDefaults] valueForKey:key] boolValue]; | |
uis.tag = [indexPath section]; | |
cell.accessoryView = uis; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <UIKit/UIKit.h> | |
@interface MyOwnTableViewCell : UITableViewCell | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Trimming white spaces and new line characters from a NSString | |
NSString *s = @" hellow world. "; | |
NSString *trimmedString= [s stringByTrimmingCharactersInSet: [NSCharacterSet whitespaceAndNewlineCharacterSet]]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Example for UIControlStateNormal | |
[yourbutton setTitleColor:<your color> forState:UIControlStateNormal]; | |
// Example for UIControlStateHighlighted | |
[yourbutton setTitleColor:<your color> forState:UIControlStateHighlighted]; | |
// And so on... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cell.textLabel.highlightedTextColor = <your color>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cell.selectedBackgroundView = [[[UIView alloc] initWithFrame:CGRectZero] autorelease]; | |
cell.selectedBackgroundView.backgroundColor = <your color>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dispatch_async(dispatch_get_main_queue(), ^{ | |
/* your code */ | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// SomeViewController.m | |
// | |
- (IBAction)doShowSomething:(id)sender | |
{ | |
UINavigationController *nav = [[[UINavigationController alloc]init] autorelease]; | |
MyViewController *av = [[[MyViewController alloc] init] autorelease]; | |
[nav pushViewController:av animated:NO]; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Horizontal flip transition of a modal view | |
MyViewController *av = [[[MyViewController alloc] init] autorelease]; | |
[av setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal]; | |
[av setModalPresentationStyle:UIModalPresentationCurrentContext]; | |
[self presentModalViewController:av animated:YES]; | |
[av release]; |
NewerOlder