Skip to content

Instantly share code, notes, and snippets.

View mikina's full-sized avatar
🤓

Mike Mikina mikina

🤓
View GitHub Profile
@mikina
mikina / nextField
Created November 19, 2013 20:28
Next field in form by tag property.
-(BOOL)textFieldShouldReturn:(UITextField*)textField;
{
NSInteger nextTag = textField.tag + 1;
// Try to find next responder
UIResponder* nextResponder = [textField.superview viewWithTag:nextTag];
if (nextResponder) {
// Found next responder, so set it.
[nextResponder becomeFirstResponder];
} else {
// Not found, so remove keyboard.
@mikina
mikina / zoomToFitMapAnnotations
Created November 18, 2013 19:31
Zoom to see all annotations on Mapkit iOS
-(void)zoomToFitMapAnnotations:(MKMapView*)mapView
{
if([mapView.annotations count] == 0)
return;
CLLocationCoordinate2D topLeftCoord;
topLeftCoord.latitude = -90;
topLeftCoord.longitude = 180;
CLLocationCoordinate2D bottomRightCoord;
@mikina
mikina / location.sh
Created September 22, 2013 12:13
Move iTunes backup to different location.
ln -s /Volumes/MacintoshHD/Users/mike/Documents/MobileSync/Backup/ ~/Library/Application\ Support/MobileSync/Backup
@mikina
mikina / tizen.sh
Created June 30, 2013 11:42
Tizen VM issue on mac.
sudo sysctl -w kern.sysv.shmmax = 1610612736
sudo sysctl -w kern.sysv.shmall = 393216
@mikina
mikina / table_view.m
Created June 21, 2013 16:53
How to hide empty cells in UITableView?
- (void) viewDidLoad
{
[super viewDidLoad];
self.tableView.tableFooterView = [[UIView alloc] init];
}
@mikina
mikina / convert.sh
Created May 26, 2013 22:21
ffmpeg conversion
./ffmpeg -i video_in.avi -acodec aac -ac 2 -strict experimental -ab 160k -s 624x352 -vcodec libx264 -preset slow -profile:v baseline -level 30 -maxrate 10000000 -bufsize 10000000 -b 1200k -f mp4 -threads 0 video_out_file.mp4
@mikina
mikina / vars.php
Created May 24, 2013 13:43
Show all defined vars
print_r( get_defined_vars() );
@mikina
mikina / dateFormatter
Created May 22, 2013 12:00
Date format
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"dd-MM-yy' 'HH:mm:ss' 'Z"];
NSLog(@"%@", [dateFormatter stringFromDate:[NSDate date]]);
@mikina
mikina / git_archive
Created May 20, 2013 19:59
Git archive
git archive master | bzip2 > ~/repo.tar.bz2
different branch
git archive v2 | bzip2 > /Volumes/Data/repo.tar.bz2
extract: