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
NSLog(@"app dir: %@",[[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject]); | |
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
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0) | |
{ [[UIApplication sharedApplication] registerUserNotificationSettings: | |
[UIUserNotificationSettings settingsForTypes: | |
(UIUserNotificationTypeSound | | |
UIUserNotificationTypeAlert | | |
UIUserNotificationTypeBadge) categories:nil]]; | |
[[UIApplication sharedApplication] registerForRemoteNotifications]; | |
} | |
else |
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
openssl pkcs12 -in Certificatesdev.p12 -out Certificatesdev.pem -nodes -clcerts |
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
fuser -v 8080/tcp -- give you list of pids using that port and that protocol | |
kill -s 15 pid -- kill //the process 15 could be 9 as well | |
or fuser -f ** not sure | |
- ps -aux |grep node | |
Close an application on some port on MAC | |
lsof | grep tcp | |
kill -9 ppid |
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
git rev-list HEAD --count |
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
find . -type f | xargs wc -l | |
For specific file extension | |
find . -name '*.m' | xargs wc -l |
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
Collection View Cell Size | |
Snippet for sizing the collectionViewCell depending on the screen size | |
Given its original designed for 4.7" inches | |
-(CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath{ | |
return CGSizeMake(<#currentWidthfor4.7inches#> *self.view.bounds.size.height/667.0, <#height#>*self.view.bounds.size.width/375.0); | |
} |
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
Snippet From Apple sample Code | |
UIImage *backButtonBackgroundImage = [UIImage imageNamed:@"back"]; | |
// The background should be pinned to the left and not stretch. | |
float margin = 12.0; | |
backButtonBackgroundImage = [backButtonBackgroundImage resizableImageWithCapInsets:UIEdgeInsetsMake(0, backButtonBackgroundImage.size.width - margin, 0, 0)]; | |
id appearance = [UIBarButtonItem appearanceWhenContainedIn:[ | |
CustomBackButtonNavController class], nil]; |
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
/** Find the Y point of a view related to the main screen | |
@pramater UIView the view to start | |
@return CGFloat the y point to the main screen | |
*/ | |
func findOutTheYPointToTheScreen(view: UIView) -> CGFloat { | |
var ypointSummation: CGFloat = view.frame.origin.y | |
var tView = view | |
while let v = tView.superview { | |
ypointSummation += v.frame.origin.y |
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
// | |
// DetectBlur.swift | |
// | |
// Created by Moath_Othman on 2/9/16. | |
// | |
import Foundation | |
//inpired by https://gist.github.com/mortenbekditlevsen/5a0ee16b73a084ba404d | |
extension UIDevice { | |
public func MO_isBlurAvailable() -> Bool { |
OlderNewer