Skip to content

Instantly share code, notes, and snippets.

View rolandkakonyi's full-sized avatar

Roland Kákonyi rolandkakonyi

View GitHub Profile
#!/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
#define RETAIN_COUNT(object) (long)CFGetRetainCount((__bridge CFTypeRef)object);
#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); \
})
@rolandkakonyi
rolandkakonyi / swifty_objc.h
Created February 1, 2020 14:22
Swifty Macros for Objective-C
#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
//
// 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>
@rolandkakonyi
rolandkakonyi / PSPDFGenerics.h
Created February 1, 2020 14:12 — forked from steipete/PSPDFGenerics.h
Override copy and mutableCopy on Objective-C collection classes to pass along both the collection type and the generic info. This is a header-only "library". MIT licensed. Craving for more? foreach: https://gist.github.com/steipete/7e3c69b985165dc23c5ec169b857ff42 even more: https://pspdfkit.com/blog/2016/swifty-objective-c/ - ships in https://p…
//
// 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.
/**
import Foundation
protocol DefaultRawValueDecodable: RawRepresentable, Decodable {
static var defaultValue: Self { get }
}
extension DefaultRawValueDecodable where RawValue: Decodable {
init(from decoder: Decoder) throws {
import Foundation
extension CALayer {
public func animate() -> CALayerAnimate {
return CALayerAnimate(layer: self)
}
}
public class CALayerAnimate {
#!/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,
@rolandkakonyi
rolandkakonyi / resizeLabelFont.m
Created July 17, 2018 08:42
UILabel auto font size
- (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:@"..."];