Skip to content

Instantly share code, notes, and snippets.

View cntrump's full-sized avatar
👀
Connecting...

cntrump

👀
Connecting...
View GitHub Profile
@cntrump
cntrump / UIImage+Extension.h
Created November 9, 2020 09:05
UIImage Extensions
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface UIImage (Extension)
+ (instancetype)imageWithSize:(CGSize)size drawingHandler:(BOOL (^)(CGRect bounds))handler;
+ (instancetype)imageWithColor:(UIColor *)color;
@cntrump
cntrump / UIColor+Extension.h
Last active November 9, 2020 09:06
UIColor Extensions
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface UIColor (Extension)
+ (instancetype)colorWithRGB:(NSUInteger)value alpha:(CGFloat)alpha;
@end
@cntrump
cntrump / chromastyles.sh
Created December 17, 2019 10:45
Export all chroma styles
#!/bin/zsh
styles=( \
abap \
algol \
algol_nu \
api \
arduino \
autumn \
borland \
bw \
@cntrump
cntrump / hexcolor.swift
Created December 6, 2019 03:16
add CSS Hex Color support for UIColor with Swift
extension UIColor {
static func hex(_ val: UInt) -> UIColor {
var r: UInt = 0, g: UInt = 0, b: UInt = 0;
var a: UInt = 0xFF
var rgb = val
if (val & 0xFFFF0000) == 0 {
a = 0xF
if val & 0xF000 > 0 {