Skip to content

Instantly share code, notes, and snippets.

View zeedark's full-sized avatar
💭
There.

Zeed Ark zeedark

💭
There.
View GitHub Profile
# 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
@zeedark
zeedark / stuff.m
Created October 17, 2012 09:22
UISwitch on an Accessory View of a UITableCellViewController
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;
@zeedark
zeedark / MyOwnTableViewCell.h
Created February 6, 2012 14:37
Modifying the default UITableViewCell's layout
#import <UIKit/UIKit.h>
@interface MyOwnTableViewCell : UITableViewCell
@end
@zeedark
zeedark / gist:1744818
Created February 5, 2012 11:15
Trimming white spaces and new line characters from a NSString
// Trimming white spaces and new line characters from a NSString
NSString *s = @" hellow world. ";
NSString *trimmedString= [s stringByTrimmingCharactersInSet: [NSCharacterSet whitespaceAndNewlineCharacterSet]];
@zeedark
zeedark / gist:1730218
Created February 3, 2012 13:41
Change UIButton title color
// Example for UIControlStateNormal
[yourbutton setTitleColor:<your color> forState:UIControlStateNormal];
// Example for UIControlStateHighlighted
[yourbutton setTitleColor:<your color> forState:UIControlStateHighlighted];
// And so on...
@zeedark
zeedark / gist:1730176
Created February 3, 2012 13:25
Change font color of a UITableCellView when selected
cell.textLabel.highlightedTextColor = <your color>;
@zeedark
zeedark / gist:1730167
Created February 3, 2012 13:23
Change selected color of a UITableViewCell
cell.selectedBackgroundView = [[[UIView alloc] initWithFrame:CGRectZero] autorelease];
cell.selectedBackgroundView.backgroundColor = <your color>;
@zeedark
zeedark / gist:1709849
Created January 31, 2012 10:45
Perform drawing-related operations on the main thread
dispatch_async(dispatch_get_main_queue(), ^{
/* your code */
});
@zeedark
zeedark / gist:1690396
Created January 27, 2012 19:11
Horizontal flip transition of a modal view with back button
//
// SomeViewController.m
//
- (IBAction)doShowSomething:(id)sender
{
UINavigationController *nav = [[[UINavigationController alloc]init] autorelease];
MyViewController *av = [[[MyViewController alloc] init] autorelease];
[nav pushViewController:av animated:NO];
@zeedark
zeedark / gist:1690332
Created January 27, 2012 18:57
Horizontal flip transition of a modal view
// 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];