Skip to content

Instantly share code, notes, and snippets.

View coolio107's full-sized avatar

Joerg Schwieder coolio107

View GitHub Profile
@coolio107
coolio107 / gist:f843789e5225c1f6fc9b
Last active November 17, 2017 05:54
relativeInterfaceOrientationFromRotationAngle class extension for UIViewController
- (UIInterfaceOrientation)relativeInterfaceOrientationFromRotationAngle:(CGFloat)angle {
NSArray * conversionMatrix = @[ @(UIInterfaceOrientationPortrait),
@(UIInterfaceOrientationLandscapeRight),
@(UIInterfaceOrientationPortraitUpsideDown),
@(UIInterfaceOrientationMaskLandscapeLeft)];
NSInteger oldIndex = [conversionMatrix indexOfObject:@(self.interfaceOrientation)];
if (oldIndex == NSNotFound)
return UIInterfaceOrientationUnknown;
NSInteger newIndex = (oldIndex - (NSInteger)roundf(angle / M_PI_2)) % 4;
@coolio107
coolio107 / keybase.md
Created April 12, 2014 05:47
Keybase Proof

Keybase proof

I hereby claim:

  • I am coolio107 on github.
  • I am coolio (https://keybase.io/coolio) on keybase.
  • I have a public key whose fingerprint is 615F 1BFA 954F 1493 3897 714A 18E8 7C7B FD6A B005

To claim this, I am signing this object:

@coolio107
coolio107 / IPBlurImage.m
Last active August 29, 2015 13:58
CoreImage snippet for UIImage blurring
//
// CoreImage filter chain to blur an arbitrary UIImage
// Input: blur radius and target size
// This is assumed to be called on a background queue, it takes a response block to process the completed, blurred image
// <C> 2013/2014 Joerg Schwieder, use at will; I'd love to see an attribution, of course but don't demand it.
// Contains some pseudo code, see comments.
//
+ (CGFloat)blurRadius {