(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
#!/usr/bin/ruby | |
# Convert a Markdown README to HTML with Github Flavored Markdown | |
# Github and Pygments styles are included in the output | |
# | |
# Requirements: json gem (`gem install json`) | |
# | |
# Input: STDIN or filename | |
# Output: STDOUT | |
# Arguments: "-c" to copy to clipboard (or "| pbcopy"), or "> filename.html" to output to a file | |
# cat README.md | flavor > README.html |
#import <UIKit/UIKit.h> | |
#import <ImageIO/ImageIO.h> | |
#import <MobileCoreServices/MobileCoreServices.h> | |
static UIImage *frameImage(CGSize size, CGFloat radians) { | |
UIGraphicsBeginImageContextWithOptions(size, YES, 1); { | |
[[UIColor whiteColor] setFill]; | |
UIRectFill(CGRectInfinite); | |
CGContextRef gc = UIGraphicsGetCurrentContext(); | |
CGContextTranslateCTM(gc, size.width / 2, size.height / 2); |
// 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; |
ACTION | |
AD_HOC_CODE_SIGNING_ALLOWED | |
ALTERNATE_GROUP | |
ALTERNATE_MODE | |
ALTERNATE_OWNER | |
ALWAYS_SEARCH_USER_PATHS | |
ALWAYS_USE_SEPARATE_HEADERMAPS | |
APPLE_INTERNAL_DEVELOPER_DIR | |
APPLE_INTERNAL_DIR | |
APPLE_INTERNAL_DOCUMENTATION_DIR |
/* | |
File: UIImage+ImageEffects.h | |
Abstract: This is a category of UIImage that adds methods to apply blur and tint effects to an image. This is the code you’ll want to look out to find out how to use vImage to efficiently calculate a blur. | |
Version: 1.0 | |
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple | |
Inc. ("Apple") in consideration of your agreement to the following | |
terms, and your use, installation, modification or redistribution of | |
this Apple software constitutes acceptance of these terms. If you do | |
not agree with these terms, please do not use, install, modify or |
#!/bin/bash | |
###################################################################### | |
#This is an example of using getopts in Bash. It also contains some | |
#other bits of code I find useful. | |
#Author: Linerd | |
#Website: http://tuxtweaks.com/ | |
#Copyright 2014 | |
#License: Creative Commons Attribution-ShareAlike 4.0 | |
#http://creativecommons.org/licenses/by-sa/4.0/legalcode |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
Update 4/10/2017: updated script working with Cocoapod 1.3.1
... If you are using CocoaPods, you may want to remove unwanted localizations using the pre install script below. Modify the supported_locales array to match your supported locales and paste it into your Podfile.
Note the all lowercase
platform :ios, '9.0'
protocol Thing { | |
typealias argType | |
func doit(val:argType) -> argType | |
} | |
class IntThing : Thing { | |
func doit(val: Int) -> Int { | |
return val + 1 | |
} | |
} |
-(UIImage*)mmg_imageScaledToFitSize:(CGSize)fitSize | |
{ | |
// Create a vImage_Buffer from the CGImage | |
CGImageRef sourceRef = self.CGImage; | |
vImage_Buffer srcBuffer; | |
vImage_CGImageFormat format = { | |
.bitsPerComponent = 8, | |
.bitsPerPixel = 32, | |
.colorSpace = NULL, | |
.bitmapInfo = (CGBitmapInfo)kCGImageAlphaFirst, |