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
public func copyFileToUserDocuments(forResource name: String, | |
ofType ext: String, | |
bundle: Bundle? = nil) throws { | |
let bundle = bundle ?? Bundle.main | |
guard | |
let bundlePath = bundle.path(forResource: name, ofType: ext), | |
let destPath = NSSearchPathForDirectoriesInDomains(.documentDirectory, | |
.userDomainMask, | |
true).first else { return } | |
let fileName = "\(name).\(ext)" |
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
- (void)adjustConstraintsAndApplyAnimationsForCell:(NGContactCollectionViewCell *)cell | |
{ | |
CGFloat imageWidth = 104.0; | |
CGFloat imageHeight = 104.0; | |
CGFloat defaultActionImageHeight = (self.editing) ? 18.0 : 27.0; | |
CGFloat nameLabelXOffset = (self.editing) ? 5.0 : 4.0; | |
CGFloat nameFontSize = (self.editing) ? 12.0 : 16.0; | |
BOOL contactHasImage = cell.contact.hasContactImage; |
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
[[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"tel://"]]; |
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
from django.forms.models import model_to_dict | |
model_to_dict(intance, fields=[], exclude=[]) |
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
NSDictionary* fileAttributes = [[NSFileManager defaultManager] attributesOfFileSystemForPath:@"/" | |
error:&error]; | |
unsigned long long freeSpace = [[fileAttributes objectForKey:NSFileSystemFreeSize] longLongValue]; | |
NSLog(@"free disk space: %dGB", (int)(freeSpace / 1073741824)); |
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
- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text { | |
if([text isEqualToString:@"\n"]) { | |
[textView resignFirstResponder]; | |
return NO; | |
} | |
return YES; | |
} |
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 checkout seotweaks | |
git merge -s ours master | |
git checkout master | |
git merge seotweaks |
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
// The application launches. Then... | |
// This creates the red light view, sets its initial opacity to 75%, and adds to window. | |
_redLightView = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"RedLight"]] autorelease]; | |
_redLightView.layer.opacity = 0.75; | |
_redLightView.frame = CGRectMake(0, 170, 235, 417); | |
_redLightView.backgroundColor = [UIColor clearColor]; | |
[self.window addSubview:_redLightView]; |
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
CABasicAnimation *fullRotation = [CABasicAnimation animationWithKeyPath:@"transform.rotation"]; | |
fullRotation.fromValue = [NSNumber numberWithFloat:0]; | |
fullRotation.toValue = [NSNumber numberWithFloat:((360*M_PI)/180)]; | |
fullRotation.duration = 6; | |
fullRotation.repeatCount = 1e100f; | |
[myview.layer addAnimation:fullRotation forKey:@"360"]; |
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
[[self.tableView layer] setCornerRadius:10]; | |
[self.tableView setClipsToBounds:YES]; | |
[[self.tableView layer] setBorderColor: | |
[[UIColor colorWithRed:0.52 green:0.09 blue:0.07 alpha:1] CGColor]]; | |
[[self.tableView layer] setBorderWidth:2.75]; |
NewerOlder