This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BaseImageProcessor { | |
func createARGBBitmapContext(imageRef : CGImageRef) -> CGContextRef! { | |
var pixelWidth:UInt = CGImageGetWidth(imageRef); | |
var pixelHeight:UInt = CGImageGetHeight(imageRef); | |
var bitmapBytesPerRow:UInt = (pixelWidth * 4) | |
var bitmapByteCount:UInt = (bitmapBytesPerRow * pixelHeight) | |
var colorSpace:CGColorSpace = CGColorSpaceCreateDeviceRGB() | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Playground - noun: a place where people can play | |
import UIKit | |
import XCPlayground | |
//// extension | |
extension String { | |
func urlEncode() -> String! { | |
let str = self.stringByAddingPercentEncodingWithAllowedCharacters(NSCharacterSet.URLQueryAllowedCharacterSet()) | |
return (str != nil) ? str : "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Place.where("ST_Contains(polygon::geometry, ST_PointFromText('POINT(#{lon} #{lat})' , 4326 ) )") |