Linux installation notes (tested under Ubuntu 14.04LTS/12.04LTS), assuming VirtualBox is already installed on host.
This file contains hidden or 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
let mList = "[{\"content\":\"hello\"},{\"content\":\"hi\"},{\"content\":\"how are you?\"}]" | |
let JSONData = mList.dataUsingEncoding(NSUTF8StringEncoding)! | |
var json: Array<AnyObject>! | |
do { | |
json = try NSJSONSerialization.JSONObjectWithData(JSONData, options: NSJSONReadingOptions()) as? Array | |
} catch { | |
print(error) | |
} | |
var resultArray = [String]() |
This file contains hidden or 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
func convertImageToGrayScale(image: UIImage) -> UIImage { | |
// Create image rectangle with current image width/height | |
let imageRect: CGRect = CGRectMake(0, 0, image.size.width, image.size.height) | |
// Grayscale color space | |
let colorSpace: CGColorSpaceRef = CGColorSpaceCreateDeviceGray() | |
// Create bitmap content with current image size and grayscale colorspace | |
let bitmapInfo = CGBitmapInfo(CGImageAlphaInfo.None.rawValue) | |
var context = CGBitmapContextCreate(nil, UInt(image.size.width), UInt(image.size.height), 8, 0, colorSpace, bitmapInfo) |
NewerOlder