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
NSString *str = <#some string#>; | |
CGSize size; | |
CGSize maxSize = CGSizeMake(<#width#>, <#height#>); | |
UIFont *font = <#font#>; | |
if ([str respondsToSelector:@selector(boundingRectWithSize:options:attributes:context:)]) { | |
NSMutableParagraphStyle *style = [[NSMutableParagraphStyle alloc] init]; | |
[style setLineBreakMode:<#Line break mode#>]; | |
[style setAlignment:<#String alignment#>]; | |
NSDictionary *attributes = @{ NSFontAttributeName:font, | |
NSParagraphStyleAttributeName:style |
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
+ (instancetype)handler | |
{ | |
__strong static id *_sharedInstance = nil; | |
static dispatch_once_t onlyOnce; | |
dispatch_once(&onlyOnce, ^{ | |
_sharedInstance = [[self _alloc] _init]; | |
}); | |
return _sharedInstance; | |
} |
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
+ (UIColor *)colorWithHex:(NSString *)hexColor | |
{ | |
// Remove the hash if it exists | |
hexColor = [hexColor stringByReplacingOccurrencesOfString:@"#" withString:@""]; | |
int length = (int)[hexColor length]; | |
bool triple = (length == 3); | |
NSMutableArray *rgb = [[NSMutableArray alloc] init]; | |
// Make sure the string is three or six characters long | |
if (triple || length == 6) { | |
CFIndex i = 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
# необходимы установленные пакеты imagemagick и ghostscript | |
# если у нас релизная сборка, то нам нужна обычная иконка | |
if [ $CONFIGURATION = "Release" ]; then | |
return | |
fi | |
# номер версии | |
version=`/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" "${INFOPLIST_FILE}"` | |
# номер билда | |
build=`/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${INFOPLIST_FILE}"` |
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
buildNumber=$(/usr/libexec/PlistBuddy -c "Print CWBuildNumber" ${PROJECT_DIR}/TestIncrement/TestIncrement-Info.plist) | |
buildNumber=$(($buildNumber + 1)) | |
/usr/libexec/PlistBuddy -c "Set :CWBuildNumber $buildNumber" ${PROJECT_DIR}/TestIncrement/TestIncrement-Info.plist |
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
# Xcode | |
# | |
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore | |
## Build generated | |
build/ | |
DerivedData/ | |
## Various settings | |
*.pbxuser |
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 UIKit; | |
typedef void (^KeyboardAdjustingBlock)(); | |
@interface KeyboardAdjuster : NSObject | |
@property (nonatomic, assign) BOOL activated; | |
@property (nonatomic, nullable, weak) IBOutlet UIView *targetView; | |
@property (nonatomic, nullable, weak) IBOutlet NSLayoutConstraint *targetConstraint; |
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
CGFloat hue = ( arc4random_uniform(256) / 256.0 ); // 0.0 to 1.0 | |
CGFloat saturation = ( arc4random_uniform(128) / 256.0 ) + 0.5; // 0.5 to 1.0, away from white | |
CGFloat brightness = ( arc4random_uniform(128) / 256.0 ) + 0.5; // 0.5 to 1.0, away from black | |
UIColor *color = [UIColor colorWithHue:hue saturation:saturation brightness:brightness alpha:1]; |
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/sh | |
### BEGIN INIT INFO | |
# Provides: sockd | |
# Required-Start: $remote_fs $syslog | |
# Required-Stop: $remote_fs $syslog | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: Start the dante SOCKS server. | |
# Description: SOCKS (v4 and v5) proxy server daemon (sockd). | |
# This server allows clients to connect to it and |
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
#logoutput: /var/log/socks.log | |
logoutput: stderr | |
# socks clients interface and port | |
internal: eth0 port = 1080 | |
# external interface and port | |
external: eth0 | |
#internal: x.x.x.x port = 1080 | |
#external: x.x.x.x |
OlderNewer