This file contains hidden or 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
sqlite2 path/to/olddb .dump > backupfile | |
sqlite3 path/to/newdb < backupfile |
This file contains hidden or 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
// Override to allow orientations other than the default portrait orientation. | |
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { | |
// Return YES for supported orientations. | |
return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft); | |
} |
This file contains hidden or 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
UIActionSheet *popupQuery = [[UIActionSheet alloc] initWithTitle:@"What to do?" delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:@"Remove" otherButtonTitles:@"Landscape", @"Portrait", nil]; | |
popupQuery.actionSheetStyle = UIActionSheetStyleBlackOpaque; | |
[popupQuery showInView:self.view]; | |
[popupQuery release]; |
This file contains hidden or 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
UIAlertView *alert = [[[UIAlertView alloc] initWithTitle:@"Really reset?" message:@"Do you really want to reset this game?" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:nil] autorelease]; | |
[alert addButtonWithTitle:@"Yes"]; | |
[alert show]; |
This file contains hidden or 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
- (void)viewDidLoad { | |
self.navigationItem.title = @"Title Here" | |
// for landscape mode use - CGRectMake(0.0, 0.0, 480, 44.0)]; | |
UIImageView *imgView = [[UIImageView alloc] initWithFrame:CGRectMake(0.0, 0.0, 320, 44.0)]; | |
[imgView setImage:[UIImage imageNamed:@"navbar_bg.png"]]; | |
// this puts image view under all other views and all the default elements (title, buttons etc) | |
[self.navigationController.navigationBar insertSubview:imgView atIndex:0]; |
This file contains hidden or 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
- (void)viewDidLoad { | |
[super viewDidLoad]; | |
// Navigation bar | |
self.navigationController.navigationBar.tintColor = [UIColor colorWithRed:.6 green:.3 blue:.2 alpha:1]; | |
// Search bar | |
self.searchDisplayController.searchBar.tintColor = [UIColor colorWithRed:.6 green:.3 blue:.2 alpha:1]; | |
} |
This file contains hidden or 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
<?php | |
$browser = "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_6; en-us) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.4 Safari/533.20.27"; | |
function extract_user_agent($agent) | |
{ | |
$found = array(); | |
$pattern = "([^/[:space:]]*)" . "(/([^[:space:]]*))?"; | |
$pattern .= "([[:space:]]*\[[a-zA-Z][a-zA-Z]\])?" . "[[:space:]]*"; | |
$pattern .= "(\\((([^()]|(\\([^()]*\\)))*)\\))?" . "[[:space:]]*"; |
This file contains hidden or 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
// Text field delegates | |
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string { | |
if ([[textField text] length] + [string length] - range.length > MAX_LENGTH) { | |
return NO; | |
} else { | |
return YES; | |
} | |
} |
This file contains hidden or 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
$ git branch experimental | |
$ git branch | |
$ git checkout experimental | |
(edit file) | |
$ git commit -a | |
$ git checkout master | |
(edit file) | |
$ git commit -a | |
$ git merge experimental | |
$ git diff |
This file contains hidden or 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
defaults write com.apple.Xcode PBXCustomTemplateMacroDefinitions '{ORGANIZATIONNAME="YourNameHere";}' |
OlderNewer