<commit_before>//
//  HistoryTableViewController.swift
//  LotifyMe
//
//  Created by <NAME> on 1/26/15.
//  Copyright (c) 2015 LocoLabs. All rights reserved.
//

import UIKit

class HistoryTableViewController: UITableViewController, UITableViewDelegate, UITableViewDataSource {
    
//    var picks = [Pick]()
    
    // SHOW PICKS GET REQUEST
    
    func showPicksGetRequest() {
        
        struct Status : JSONJoy {
            var status: String?
            init() {
                
            }
            init(_ decoder: JSONDecoder) {
                status = decoder["status"].string
            }
        }
        
        var getRequest = HTTPTask()
        
        let pick: Dictionary<String,String> = [
            "email": "\(retrieveSession())",
        ]
        
        let params: Dictionary<String,AnyObject> = [
            "pick": pick
        ]

        var keepCheckingForCompletion = true
        var getRequestCompleted = false
        
        getRequest.GET(
            "http://localhost:4848/picks",
            parameters: params,
            success: {
                (response: HTTPResponse) in
                println("showPicksGetRequest() called: Server returned success") // Report
                if response.responseObject != nil {
                    let resp = Status(JSONDecoder(response.responseObject!))
                    self.showPicksGetRequestResponseParser("\(response.text())")
                    getRequestCompleted = true
                }
            },
            failure: {
                (error: NSError, response: HTTPResponse?) in
                println("showPicksGetRequest() called: Server returned failure") // Report
            }
        )
        
        while keepCheckingForCompletion == true {
            if getRequestCompleted == true {
                keepCheckingForCompletion = false
                tableView.reloadData()
            }
        }
        
    }
    
    // SHOW PICKS GET REQUEST RESPONSE PARSER
    
    func showPicksGetRequestResponseParser(jsonAsString: String) -> [pick] {

        var jsonAsStringClean = jsonAsString.stringByReplacingOccurrencesOfString(
            "result\\\":null",
            withString: "result\\\":\\\"No Result\\\"",
            options: NSStringCompareOptions.LiteralSearch,
            range: nil
        )

        var jsonCharset = NSCharacterSet(charactersInString: "\\\"")
        var jsonAsArray = jsonAsStringClean.componentsSeparatedByCharactersInSet(jsonCharset)

//        var picks = [Pick]()

        if (jsonAsArray.count - 3) % 64 == 0 {

            var numberOfPicks = (jsonAsArray.count - 3) / 64
            
            for (var i = 0; i < numberOfPicks; i++) {

                var game = jsonAsArray[11 + i * 64]
                var result = jsonAsArray[19 + i * 64]
                var number = jsonAsArray[47 + i * 64]
                var draw_date_raw = jsonAsArray[55 + i * 64] as NSString
                var draw_date = draw_date_raw.substringWithRange(NSRange(location: 0, length: 10))

//                var pick = Pick(
//                    number: number,
//                    draw_date: draw_date,
//                    result: result,
//                    game: game
//                )
//                
//                picks.append(
//                    pick
//                )
                
                pickMGR.addPick(number, draw_date: draw_date, result: result, game: game)
                
            }
            
        }
        
        return pickMGR.picks
        
    }
    
    // SETUP
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        showPicksGetRequest()
        println(pickMGR.picks[0].result)
        println(pickMGR.picks[1].result)
        println(pickMGR.picks[2].result)
    }
    
    
    // TABEL CELL FUNCS
    
    @IBOutlet var historyTableView: UITableView!
    
    override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
        return 1
    }
    
    override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) ->Int {
        return pickMGR.picks.count
    }
    
    override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell
    {
        var cell: PickCell = tableView.dequeueReusableCellWithIdentifier("PickCell") as PickCell
        
        if indexPath.row % 2 == 0
        {
            cell.backgroundColor = UIColor.purpleColor()
        }
        else
        {
           cell.backgroundColor = UIColor.orangeColor()
        }
        
  
        cell.leftTopLable?.text = pickMGR.picks[indexPath.row].game
        cell.leftBottomLabel?.text = pickMGR.picks[indexPath.row].draw_date
        cell.rightTopLabel?.text = pickMGR.picks[indexPath.row].number
        cell.rightBottomLable?.text = pickMGR.picks[indexPath.row].result
        return cell
    }
    
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
    }
    
}
<commit_msg>dd swipe to delete without http<commit_after>//
//  HistoryTableViewController.swift
//  LotifyMe
//
//  Created by <NAME> on 1/26/15.
//  Copyright (c) 2015 LocoLabs. All rights reserved.
//

import UIKit

class HistoryTableViewController: UITableViewController, UITableViewDelegate, UITableViewDataSource {
    
//    var picks = [Pick]()
    
    // SHOW PICKS GET REQUEST
    
    func showPicksGetRequest() {
        
        struct Status : JSONJoy {
            var status: String?
            init() {
                
            }
            init(_ decoder: JSONDecoder) {
                status = decoder["status"].string
            }
        }
        
        var getRequest = HTTPTask()
        
        let pick: Dictionary<String,String> = [
            "email": "\(retrieveSession())",
        ]
        
        let params: Dictionary<String,AnyObject> = [
            "pick": pick
        ]

        var keepCheckingForCompletion = true
        var getRequestCompleted = false
        
        getRequest.GET(
            "http://localhost:4848/picks",
            parameters: params,
            success: {
                (response: HTTPResponse) in
                println("showPicksGetRequest() called: Server returned success") // Report
                if response.responseObject != nil {
                    let resp = Status(JSONDecoder(response.responseObject!))
                    self.showPicksGetRequestResponseParser("\(response.text())")
                    getRequestCompleted = true
                }
            },
            failure: {
                (error: NSError, response: HTTPResponse?) in
                println("showPicksGetRequest() called: Server returned failure") // Report
            }
        )
        
        while keepCheckingForCompletion == true {
            if getRequestCompleted == true {
                keepCheckingForCompletion = false
                tableView.reloadData()
            }
        }
        
    }
    
    // SHOW PICKS GET REQUEST RESPONSE PARSER
    
    func showPicksGetRequestResponseParser(jsonAsString: String) -> [pick] {

        var jsonAsStringClean = jsonAsString.stringByReplacingOccurrencesOfString(
            "result\\\":null",
            withString: "result\\\":\\\"No Result\\\"",
            options: NSStringCompareOptions.LiteralSearch,
            range: nil
        )

        var jsonCharset = NSCharacterSet(charactersInString: "\\\"")
        var jsonAsArray = jsonAsStringClean.componentsSeparatedByCharactersInSet(jsonCharset)

//        var picks = [Pick]()

        if (jsonAsArray.count - 3) % 64 == 0 {

            var numberOfPicks = (jsonAsArray.count - 3) / 64
            
            for (var i = 0; i < numberOfPicks; i++) {

                var game = jsonAsArray[11 + i * 64]
                var result = jsonAsArray[19 + i * 64]
                var number = jsonAsArray[47 + i * 64]
                var draw_date_raw = jsonAsArray[55 + i * 64] as NSString
                var draw_date = draw_date_raw.substringWithRange(NSRange(location: 0, length: 10))

//                var pick = Pick(
//                    number: number,
//                    draw_date: draw_date,
//                    result: result,
//                    game: game
//                )
//                
//                picks.append(
//                    pick
//                )
                
                pickMGR.addPick(number, draw_date: draw_date, result: result, game: game)
                
            }
            
        }
        
        return pickMGR.picks
        
    }
    
    // SETUP
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        showPicksGetRequest()
        
    }
    
    
    // TABEL CELL FUNCS
    
    @IBOutlet var historyTableView: UITableView!
    
    override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
        return 1
    }
    
    override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) ->Int {
        return pickMGR.picks.count
    }
    
    override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell
    {
        var cell: PickCell = tableView.dequeueReusableCellWithIdentifier("PickCell") as PickCell
        
        if indexPath.row % 2 == 0
        {
            cell.backgroundColor = UIColor.purpleColor()
        }
        else
        {
           cell.backgroundColor = UIColor.orangeColor()
        }
        
  
        cell.leftTopLable?.text = pickMGR.picks[indexPath.row].game
        cell.leftBottomLabel?.text = pickMGR.picks[indexPath.row].draw_date
        cell.rightTopLabel?.text = pickMGR.picks[indexPath.row].number
        cell.rightBottomLable?.text = pickMGR.picks[indexPath.row].result
        return cell
    }
    
    override func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath){
        if editingStyle == UITableViewCellEditingStyle.Delete
        {
            pickMGR.picks.removeAtIndex(indexPath.row)
            self.historyTableView.reloadData()
        }
    }
    
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
    }
    
}

{'fraction_non_alphanumeric': 0.09172627102261743, 'fraction_numerical': 0.008602358399381404, 'mean_word_length': 1.5713220675944335, 'pattern_counts': {'":': 8, '<': 11, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6332477', 'n_tokens_mistral': 2952, 'n_tokens_neox': 2732, 'n_words': 563}