<commit_before>//
//  ViewController.swift
//  Hokusai
//
//  Created by ytakzk on 07/12/2015.
//  Copyright (c) 2015 ytakzk. All rights reserved.
//

import UIKit

class ViewController: UIViewController, UICollectionViewDataSource, UICollectionViewDelegate {

    @IBOutlet weak var collectionView: UICollectionView!
    
    var items = [HOKColorScheme.Hokusai, HOKColorScheme.Asagi, HOKColorScheme.Matcha, HOKColorScheme.Tsubaki,
    HOKColorScheme.Inari, HOKColorScheme.Karasu, HOKColorScheme.Enshu]
    
    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    
    // MARK: - UICollectionViewDelegate Protocol
    func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
        let cell:ThumbnailCell = collectionView.dequeueReusableCellWithReuseIdentifier("ThumbnailCell", forIndexPath: indexPath) as! ThumbnailCell
        
        var name = "Custom"
        if indexPath.row < items.count {
            name = getName(items[indexPath.row])
        }
        
        cell.photoImageView.image = UIImage(named: name)
        cell.nameLabel.text       = name
        return cell
    }
    
    func numberOfSectionsInCollectionView(collectionView: UICollectionView) -> Int {
        return 1
    }
    
    func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
        return items.count + 1
    }
    
    func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAtIndexPath indexPath: NSIndexPath) -> CGSize {
        let width  = self.view.frame.width
        let height = self.view.frame.height
        let length = (width < height) ? width*0.5 : width/3
        
        return CGSize(width: length, height: length)
    }
    
    func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) {
        /////////////////////////////////////////////
        // Here is the implementation for Hokusai. //
        /////////////////////////////////////////////
        
        // Init with title
        let hokusai2 = Hokusai(headline: "Information")
        
        // Init with title and message
        let hokusai3 = Hokusai(headline: "Information", message: "This can be a long multi-lined message.")
        
        // ...or add title and message later
        hokusai2.headline = "Infomration"
        hokusai2.message  = "This can be a long multi-lined message."
        
        let hokusai = Hokusai()
        if indexPath.row % 2 == 0 {
            
            // Add a title
            hokusai.headline = "Information"
            
            // Add a message
            hokusai.message  = "Katsushika Hokusai (葛飾 北斎) was a Japanese artist, ukiyo-e painter and printmaker of the Edo period."
        }
        
        // Add a button with a closure
        hokusai.addButton("Button 1") {<commit_msg>Forgot to remove example code. 🙈<commit_after>//
//  ViewController.swift
//  Hokusai
//
//  Created by ytakzk on 07/12/2015.
//  Copyright (c) 2015 ytakzk. All rights reserved.
//

import UIKit

class ViewController: UIViewController, UICollectionViewDataSource, UICollectionViewDelegate {

    @IBOutlet weak var collectionView: UICollectionView!
    
    var items = [HOKColorScheme.Hokusai, HOKColorScheme.Asagi, HOKColorScheme.Matcha, HOKColorScheme.Tsubaki,
    HOKColorScheme.Inari, HOKColorScheme.Karasu, HOKColorScheme.Enshu]
    
    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    
    // MARK: - UICollectionViewDelegate Protocol
    func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
        let cell:ThumbnailCell = collectionView.dequeueReusableCellWithReuseIdentifier("ThumbnailCell", forIndexPath: indexPath) as! ThumbnailCell
        
        var name = "Custom"
        if indexPath.row < items.count {
            name = getName(items[indexPath.row])
        }
        
        cell.photoImageView.image = UIImage(named: name)
        cell.nameLabel.text       = name
        return cell
    }
    
    func numberOfSectionsInCollectionView(collectionView: UICollectionView) -> Int {
        return 1
    }
    
    func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
        return items.count + 1
    }
    
    func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAtIndexPath indexPath: NSIndexPath) -> CGSize {
        let width  = self.view.frame.width
        let height = self.view.frame.height
        let length = (width < height) ? width*0.5 : width/3
        
        return CGSize(width: length, height: length)
    }
    
    func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) {
        /////////////////////////////////////////////
        // Here is the implementation for Hokusai. //
        /////////////////////////////////////////////
        
        let hokusai = Hokusai()
        if indexPath.row % 2 == 0 {
            
            // Add a title
            hokusai.headline = "Information"
            
            // Add a message
            hokusai.message  = "Katsushika Hokusai (葛飾 北斎) was a Japanese artist, ukiyo-e painter and printmaker of the Edo period."
        }
        
        // Add a button with a closure
        hokusai.addButton("Button 1") {
{'fraction_non_alphanumeric': 0.10685114185697617, 'fraction_numerical': 0.0073345557592932155, 'mean_word_length': 2.186404673393521, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, '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': '7041146', 'n_tokens_mistral': 1717, 'n_tokens_neox': 1694, 'n_words': 427}