Skip to content

Instantly share code, notes, and snippets.

View zakol's full-sized avatar

Dawid Żakowski zakol

View GitHub Profile
@zakol
zakol / gist:82798fc51a0277563eea
Created January 23, 2015 09:02
Custom color for iOS status bar text
#import <UIKit/UIKit.h>
#import <objc/runtime.h>
@interface UIStatusBar : NSObject @end
@implementation UIStatusBar (CustomColor)
+ (void)load
{
static dispatch_once_t onceToken;
+ (dispatch_block_t)performBlock:(void (^)(dispatch_block_t safeBlock))block
{
dispatch_block_t strongBlock;
__weak __block dispatch_block_t weakBlock = strongBlock = ^{
block(weakBlock);
};
strongBlock();
return strongBlock;
}
@rsobik
rsobik / boost.sh
Created November 17, 2013 13:20
Build Boost 1.55.0 for iOS 7 and OS X including 64 Bit
#===============================================================================
# Filename: boost.sh
# Author: Pete Goodliffe
# Copyright: (c) Copyright 2009 Pete Goodliffe
# Licence: Please feel free to use this, with attribution
# Modified version
#===============================================================================
#
# Builds a Boost framework for the iPhone.
# Creates a set of universal libraries that can be used on an iPhone and in the
@raphaelschaad
raphaelschaad / RSTimingFunction.h
Last active June 10, 2024 11:47
All the cool animation curves from `CAMediaTimingFunction` but not limited to use with CoreAnimation. See what you can do with cubic Bezier curves here: http://netcetera.org/camtf-playground.html To get started just "Download Gist", throw the .h and .m files into your Xcode project and you're good to go!
//
// RSTimingFunction.h
//
// Created by Raphael Schaad on 2013-09-28.
// This is free and unencumbered software released into the public domain.
//
#import <UIKit/UIKit.h>
@jmenter
jmenter / vImageFastBlur.c
Last active June 2, 2023 06:51
C Function to create a blurred CGimageRef (supply an image and a blur radius). Uses vImage Accelerate Framework for Mac OS X/iOS 5+ and is VERY fast.
// Assumes ARGB8888
CGImageRef CGImageCreateBlurredImage(CGImageRef inImage, NSUInteger blurRadius)
{
if (!inImage) { return NULL; }
uint32_t radius = (blurRadius % 2) ? (uint32_t)blurRadius : (uint32_t)++blurRadius;
vImage_Error error;
vImage_CGImageFormat imageFormat = {(uint32_t)CGImageGetBitsPerComponent(inImage), (uint32_t)CGImageGetBitsPerPixel(inImage), CGImageGetColorSpace(inImage), CGImageGetBitmapInfo(inImage), 0, NULL, kCGRenderingIntentDefault};
vImage_Buffer source;
@irace
irace / BIWebViewDelegate.m
Created September 10, 2012 02:51
JavaScript/native bridge for iOS's UIWebView
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request
navigationType:(UIWebViewNavigationType)navigationType {
NSString *urlString = [[request URL] absoluteString];
if ([urlString hasPrefix:@"js:"]) {
NSString *jsonString = [[[urlString componentsSeparatedByString:@"js:"] lastObject]
stringByReplacingPercentEscapes];
NSData *jsonData = [jsonString dataUsingEncoding:NSUTF8StringEncoding];
NSError *error;