Skip to content

Instantly share code, notes, and snippets.

View markSci5's full-sized avatar

Mark Dhem S. Mansueto markSci5

View GitHub Profile
@markSci5
markSci5 / git-clean
Created July 24, 2013 03:19
Delete all untracked files and folders in git
git clean -f
If you want to also remove directories, run git clean -f -d.
If you just want to remove ignored files, run git clean -f -X.
If you want to remove ignored as well as non-ignored files, run git clean -f -x.
Note the case difference on the X for the two latter commands.
If clean.requireForce is set to "true" (the default) in your configuration, then unless you specify -f nothing will actually happen, with a recent enough version of git.
@markSci5
markSci5 / iOS Version Detection
Created July 16, 2013 08:00
iOS 7 and 6 detection
if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_6_1) {
// Load resources for iOS 6.1 or earlier
} else {
// Load resources for iOS 7 or later
}
@markSci5
markSci5 / UINavigationController+Autorotation.h
Created July 9, 2013 07:52
Allow navigation controller's view controllers to follow their own orientation rules
@interface UINavigationController (autorotation)
-(BOOL)shouldAutorotate;
-(NSUInteger)supportedInterfaceOrientations;
@end
@markSci5
markSci5 / Storyboard accessing category
Created July 9, 2013 03:21
Storyboard category for accessing different storyboards
@implementation UIStoryboard (MyApp)
+ (UIStoryboard *)mainStoryboard {
return [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
}
@end
@markSci5
markSci5 / UIStoryboard controller instantiation
Created July 9, 2013 03:19
UIStoryboard controller instantiation
// Get the storyboard named secondStoryBoard from the main bundle:
UIStoryboard *secondStoryBoard = [UIStoryboard storyboardWithName:@"secondStoryBoard" bundle:nil];
// Load the initial view controller from the storyboard. // Set this by selecting 'Is Initial View Controller' on the appropriate view controller in the storyboard.
UIViewController *theInitialViewController = [secondStoryBoard instantiateInitialViewController];
// Then push the new view controller in the usual way:
[self.navigationController pushViewController:theTabBar animated:YES];
@markSci5
markSci5 / Balsamiq Useful shortcuts
Created July 4, 2013 05:26
Balsamiq useful shortcuts
/ - Quick Add
Hold Shift while resizing - Maintain aspect ration
Hold Command while moving object - Removes snapping
Shift + Direction while an object is selected - Moves object faster
Command + Alt + (Shift) + Direction while an object is selected - Resizes object
Command + Up/Down - Moves selected layer up or down 1 level
Command + (Shift) + Up/Down - Moves selected layer to top or bottom layer
Alt + Drag object - Duplicate object
Shift + click another object - Add object to current selection
Command + click another object - Add object to current selection
@markSci5
markSci5 / Git checkout remote branch
Created July 3, 2013 07:08
Git checkout remote branch
//To fetch a branch, you simply need to:
git fetch origin
//This will fetch all of the remote branches for you. With the remote branches
//in hand, you now need to check out the branch you are interested in, giving
//you a local working copy:
git checkout -b test origin/test
@markSci5
markSci5 / Git stage deleted files
Created July 3, 2013 04:57
Stage all removed files
git add -u
@markSci5
markSci5 / Git Merge Config With Merge Base
Created July 3, 2013 03:32
Git config for merging to see the merge base code
git config --global merge.conflictstyle diff3
@markSci5
markSci5 / MySingleton.h
Created July 2, 2013 02:50
iOS Singleton
#import <Foundation/Foundation.h>
@interface MySingleton : NSObject
- (id)sharedInstance;
@end