See how a minor change to your commit message style can make you a better programmer.
Format: <type>(<scope>): <subject>
<scope>
is optional
import UIKit | |
import MobileCoreServices | |
let image = UIImage() // your actual image | |
let itemProvider = NSItemProvider() | |
itemProvider.registerDataRepresentation(forTypeIdentifier: kUTTypeJPEG as String, visibility: .all) { (completionBlock) -> Progress? in | |
let unitsOfWork = 10 + Int64(arc4random_uniform(UInt32(10))) // 10 - 19 units | |
let progress = Progress.discreteProgress(totalUnitCount: unitsOfWork) |
version: 2.1 | |
commands: | |
setup-sccache: | |
steps: | |
- run: | |
name: Install sccache | |
command: | | |
cargo install sccache | |
# This configures Rust to use sccache. | |
echo 'export "RUSTC_WRAPPER"="sccache"' >> $BASH_ENV |
let cls: AnyClass = NSClassFromString("NSConcreteValue")! | |
let types = "d@:" // [NSString stringWithFormat:@"%s%s%s", @encode(double), @encode(id), @encode(SEL)] | |
let block: @convention(block) (AnyObject?) -> Double = { (self: AnyObject!) -> (Double) in | |
return 1.0 | |
} | |
let imp = imp_implementationWithBlock(unsafeBitCast(block, to: AnyObject.self)) | |
class_addMethod(cls, Selector("doubleValue"), imp, types) |
#import <Foundation/Foundation.h> | |
@interface MyOutput : NSObject | |
@end | |
int main(int argc, const char * argv[]) { | |
MyOutput *output = [MyOutput new]; | |
NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:0.1 target:output | |
selector:@selector(tick) userInfo:nil repeats:YES]; |
- (int)_finderLabelColorOfPath:(NSString*)path{ | |
CFURLRef url; | |
FSRef fsRef; | |
BOOL ret; | |
FSCatalogInfo cinfo; | |
// Get FSRef | |
url = CFURLCreateWithFileSystemPath(NULL, (CFStringRef)path, kCFURLPOSIXPathStyle, FALSE); | |
if (!url) return 0; | |
ret = CFURLGetFSRef(url, &fsRef); |
static uint64_t count = 7; | |
static NSString *suffixes[7] = {@"B", @"KiB", @"MiB", @"GiB", @"TiB", @"PiB", @"EiB"}; | |
uint64_t i, c; | |
for (i = 1024, c = 0; i < (count << 60); i <<= 10, c++){ | |
if (bytes < i) | |
return [NSString stringWithFormat:@"%0.2f%@", | |
(double)bytes / (double)(i >> 10), suffixes[c]]; | |
} | |
return @"Big"; |
#Disable the OS X Crash reporter (quit dialog after an application crash) | |
defaults write com.apple.CrashReporter DialogType none | |
#To enable the crash reporter (default) change none to prompt |