<commit_before>//
//  UIImageView.swift
//  SlideMenuControllerSwift
//
//  Created by <NAME> on 11/3/15.
//  Copyright © 2015 <NAME>. All rights reserved.
//

import UIKit


extension UIImageView {
    
    func setRandomDownloadImage(width: Int, height: Int) {
        if self.image != nil {
            self.alpha = 1
            return
        }
        self.alpha = 0
        let url = NSURL(string: "https://ssl.webpack.de/lorempixel.com/\(width)/\(height)/")!
        let session = NSURLSession(configuration: NSURLSessionConfiguration.defaultSessionConfiguration())
        let task = session.dataTaskWithURL(url, completionHandler: { (data: NSData?, response: NSURLResponse?, error: NSError?) -> Void in
            if error != nil {
                return
            }
            
            if let response = response as? NSHTTPURLResponse {
                if response.statusCode / 100 != 2 {
                    return
                }
                if let data = data, let image = UIImage(data: data) {
                    dispatch_async(dispatch_get_main_queue(), { () -> Void in
                        self.image = image
                        UIView.animateWithDuration(0.3, animations: { () -> Void in
                            self.alpha = 1
                            }) { (finished: Bool) -> Void in
                        }
                    })
                }
            }
        })
        task.resume()
    }
    
    func clipParallaxEffect(baseImage: UIImage?, screenSize: CGSize, displayHeight: CGFloat) {
        if let baseImage = baseImage {
            if displayHeight < 0 {
                return<commit_msg>Modified not local cache the sample image.<commit_after>//
//  UIImageView.swift
//  SlideMenuControllerSwift
//
//  Created by <NAME> on 11/3/15.
//  Copyright © 2015 <NAME>. All rights reserved.
//

import UIKit


extension UIImageView {
    
    func setRandomDownloadImage(width: Int, height: Int) {
        if self.image != nil {
            self.alpha = 1
            return
        }
        self.alpha = 0
        let url = NSURL(string: "https://ssl.webpack.de/lorempixel.com/\(width)/\(height)/")!
        let configuration = NSURLSessionConfiguration.defaultSessionConfiguration()
        configuration.timeoutIntervalForRequest = 15
        configuration.timeoutIntervalForResource = 15
        configuration.requestCachePolicy = NSURLRequestCachePolicy.ReloadIgnoringLocalCacheData
        let session = NSURLSession(configuration: configuration)
        let task = session.dataTaskWithURL(url, completionHandler: { (data: NSData?, response: NSURLResponse?, error: NSError?) -> Void in
            if error != nil {
                return
            }
            
            if let response = response as? NSHTTPURLResponse {
                if response.statusCode / 100 != 2 {
                    return
                }
                if let data = data, let image = UIImage(data: data) {
                    dispatch_async(dispatch_get_main_queue(), { () -> Void in
                        self.image = image
                        UIView.animateWithDuration(0.3, animations: { () -> Void in
                            self.alpha = 1
                            }) { (finished: Bool) -> Void in
                        }
                    })
                }
            }
        })
        task.resume()
    }
    
    func clipParallaxEffect(baseImage: UIImage?, screenSize: CGSize, displayHeight: CGFloat) {
        if let baseImage = baseImage {
            if displayHeight < 0 {
                return
{'fraction_non_alphanumeric': 0.09543683917640512, 'fraction_numerical': 0.011686143572621035, 'mean_word_length': 1.515745276417075, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 15, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '357502', 'n_tokens_mistral': 977, 'n_tokens_neox': 900, 'n_words': 226}