Skip to content

Instantly share code, notes, and snippets.

View irpainel-zz's full-sized avatar

Iury Painelli irpainel-zz

View GitHub Profile
@irpainel-zz
irpainel-zz / cheatsheet.swift
Last active September 2, 2016 19:26
Swift Cheatsheet
//overriding delegates
private var delegate: SubclassDelegate?
override var superclassDelegate: SuperclassDelegate? {
didSet {
delegate = superclassDelegate as? SubclassDelegate
}
}
//Testing types with switch http://stackoverflow.com/a/25724652/3191130
for thing in things {
#import "ColorBlendTileOverlayRenderer.h"
#import "Colors.h"
@implementation ColorBlendTileOverlayRenderer
-(void)drawMapRect:(MKMapRect)mapRect zoomScale:(MKZoomScale)zoomScale inContext:(CGContextRef)context {
[super drawMapRect:mapRect zoomScale:zoomScale inContext:context];
CGRect rect = [self rectForMapRect:mapRect];
@irpainel-zz
irpainel-zz / GuideUtils.m
Created February 25, 2016 14:37
Guide Utils
+(BOOL)randomBool {
int tmp = (arc4random() % 30)+1;
if(tmp % 5 == 0)
return YES;
return NO;
}
+(int)randomNumberInRangeMin:(int)min max:(int)max {
return rand() % (max - min) + min;
}