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
let styles: [UIFont.TextStyle] = [ | |
// iOS 17 | |
.extraLargeTitle, .extraLargeTitle2, | |
// iOS 11 | |
.largeTitle, | |
// iOS 9 | |
.title1, .title2, .title3, .callout, | |
// iOS 7 | |
.headline, .subheadline, .body, .footnote, .caption1, .caption2, | |
] |
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
#! /bin/bash | |
source=$1 | |
path="${source}_icons" | |
mkdir -p $path | |
sips --resampleWidth 57 --out $path/Icon.png $source # 57 x 57 for iPhone non-Retina iOS6 App | |
sips --resampleWidth 114 --out $path/Icon@2x.png $source # 114 x 114 for iPhone Retina iOS6 App | |
sips --resampleWidth 72 --out $path/Icon-72.png $source # 72 x 72 for iPad non-Retina iOS6 App |
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
#import "UICollectionViewFlowLayoutCenterItem.h" | |
@implementation UICollectionViewFlowLayoutCenterItem | |
- (CGPoint)targetContentOffsetForProposedContentOffset:(CGPoint)proposedContentOffset withScrollingVelocity:(CGPoint)velocity | |
{ | |
CGSize collectionViewSize = self.collectionView.bounds.size; | |
CGFloat proposedContentOffsetCenterX = proposedContentOffset.x + self.collectionView.bounds.size.width * 0.5f; | |
CGRect proposedRect = self.collectionView.bounds; |
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
+(NSAttributedString*)attributedStringFromString:(NSString*)string font:(UIFont*)font color:(UIColor*)color{ | |
if (string==nil || ![string isKindOfClass:[NSString class]]) { | |
return [[NSAttributedString alloc] initWithString:@"" attributes:@{NSFontAttributeName:font,NSForegroundColorAttributeName:color}]; | |
} | |
NSMutableAttributedString * attrib = [[NSMutableAttributedString alloc] initWithString:string attributes:@{NSFontAttributeName:font,NSForegroundColorAttributeName:color}]; | |
NSArray * array = [TwitterText entitiesInText:attrib.string]; | |
[array enumerateObjectsUsingBlock:^(TwitterTextEntity * obj, NSUInteger idx, BOOL *stop) { | |
if (obj.type==TwitterTextEntityURL) { | |
NSURL * url = [NSURL URLWithString:[string substringWithRange:obj.range]]; | |
if (url) { |
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
package main | |
import ( | |
"fmt" | |
"labix.org/v2/mgo" | |
"labix.org/v2/mgo/bson" | |
"time" | |
) | |
type Person struct { |