Skip to content

Instantly share code, notes, and snippets.

View vlondon's full-sized avatar
😉
Night worker

Vladimirs Matusevics vlondon

😉
Night worker
View GitHub Profile
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]()
@vlondon
vlondon / README.md
Created January 4, 2016 16:51 — forked from magnetikonline/README.md
IE 7/8/9/10/11 Virtual machines from Microsoft - Linux w/VirtualBox installation notes.
@vlondon
vlondon / ImageToGrayscale.swift
Last active October 22, 2021 12:15
Convert image to grayscale
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)