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 | |
if ! [ -x "$(command -v gdate)" ]; then | |
echo 'Error: git is not installed. Run "brew install coreutils"' >&2 | |
exit 1 | |
fi | |
if ! [ -x "$(command -v gh)" ]; then | |
echo 'Error: git is not installed. Run "brew install gh"' >&2 | |
exit 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
#define RETAIN_COUNT(object) (long)CFGetRetainCount((__bridge CFTypeRef)object); |
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
#define PRINT_CALLER(cmd, arg) ({ \ | |
NSString *sourceString = [[NSThread callStackSymbols] objectAtIndex:1]; \ | |
NSCharacterSet *separatorSet = [NSCharacterSet characterSetWithCharactersInString:@" -[]+?.,"]; \ | |
NSMutableArray *array = [NSMutableArray arrayWithArray:[sourceString componentsSeparatedByCharactersInSet:separatorSet]]; \ | |
[array removeObject:@""]; \ | |
NSString *value = arg == nil ? @"nil" : [NSString stringWithFormat:@"%@", (arg)]; \ | |
NSLog(@"Caller of '%@' is '[%@ %@]', with argument: '%@'", NSStringFromSelector(cmd), [array objectAtIndex:3], [array objectAtIndex:4], value); \ | |
}) | |
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 defined(__cplusplus) | |
#define let auto const | |
#else | |
#define let const __auto_type | |
#endif | |
#if defined(__cplusplus) | |
#define var auto | |
#else | |
#define var __auto_type |
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
// | |
// PSPDFFastEnumeration.h | |
// PSPDFFoundation | |
// | |
// PSPDFKit is the leading cross-platform solution for integrating PDFs into your apps: https://pspdfkit.com. | |
// Try it today using our free PDF Viewer app: https://pdfviewer.io/ | |
// | |
// This file is MIT licensed. | |
@protocol PSPDFFastEnumeration <NSFastEnumeration> |
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
// | |
// PSPDFGenerics.h | |
// PSPDFFoundation | |
// | |
// PSPDFKit is the leading cross-platform solution for integrating PDFs into your apps: https://pspdfkit.com. | |
// Try it today using our free PDF Viewer app: https://pdfviewer.io/ | |
// | |
// This file is MIT licensed. | |
/** |
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 Foundation | |
protocol DefaultRawValueDecodable: RawRepresentable, Decodable { | |
static var defaultValue: Self { get } | |
} | |
extension DefaultRawValueDecodable where RawValue: Decodable { | |
init(from decoder: Decoder) throws { |
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 Foundation | |
extension CALayer { | |
public func animate() -> CALayerAnimate { | |
return CALayerAnimate(layer: self) | |
} | |
} | |
public class CALayerAnimate { |
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import os, json, argparse | |
print os.getcwd() | |
parser = argparse.ArgumentParser(description='Convert color assets from storyboards and xibs') | |
parser.add_argument('--colorSpace', dest="color_space", | |
type=str, |
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)resizeFontForLabel:(UILabel*)aLabel maxSize:(int)maxSize minSize:(int)minSize lblWidth: (float)lblWidth lblHeight: (float)lblHeight { | |
// use font from provided label so we don't lose color, style, etc | |
UIFont *font = aLabel.font; | |
// start with maxSize and keep reducing until it doesn't clip | |
for(int i = maxSize; i >= minSize; i--) { | |
font = [font fontWithSize:i]; | |
CGSize constraintSize = CGSizeMake(lblWidth, MAXFLOAT); | |
// NSString* string = [aLabel.text stringByAppendingString:@"..."]; |
NewerOlder