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
| Run this command: | |
| ```ffmpeg -i input.mp4 out%d.png``` | |
| If you want more options, check this ref: https://trac.ffmpeg.org/wiki/Create%20a%20thumbnail%20image%20every%20X%20seconds%20of%20the%20video |
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
| // | |
| // RoundCornerProgressView.swift | |
| // PhucNguyen | |
| // | |
| // Created by Phuc Nguyen on 8/18/16. | |
| // Copyright © 2016 Phuc Nguyen. All rights reserved. | |
| // | |
| import UIKit |
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
| import Foundation | |
| import UIKit | |
| extension String { | |
| var html2AttributedString: NSAttributedString? { | |
| guard | |
| let data = dataUsingEncoding(NSUTF8StringEncoding) | |
| else { return nil } | |
| do { |
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
| // Created by Phuc Nguyen on 7/15/16. | |
| // Copyright © 2016 Phuc Nguyen. All rights reserved. | |
| // | |
| import Foundation | |
| class ReorderTableView: UITableView { | |
| var isReorderEnabled = true | |
| var customView:UIImageView? |
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
| //Implement your willDisplayCell delegate function like that | |
| //Behind the scene | |
| //It will hide default reorder control image (three horizontal lines) | |
| //but the table view cell can still receive drag action to reorder rows | |
| //You still need to set `tableView.editing = true` | |
| //and `tableView(tableView: UITableView, canMoveRowAtIndexPath indexPath: NSIndexPath) -> Bool` to return `true` | |
| //Finally, implement `tableView(tableView: UITableView, moveRowAtIndexPath sourceIndexPath: NSIndexPath, toIndexPath destinationIndexPath: NSIndexPath)` | |
| //to handle your data changes |
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
| extension UIImage { | |
| /** | |
| Create gradient image from beginColor on top and end color at bottom | |
| - parameter beginColor: beginColor | |
| - parameter endColor: endColor | |
| - parameter frame: frame to be filled | |
| - returns: filled image | |
| */ |
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
| /** | |
| Snippet to make navigation bar transparent alpha = 0 | |
| */ | |
| func makesNavigationBarTransparent() { | |
| navigationController?.navigationBar.setBackgroundImage(UIImage(), forBarMetrics: .Default) | |
| navigationController?.navigationBar.shadowImage = UIImage() | |
| navigationController?.navigationBar.translucent = true | |
| navigationController?.navigationBar.backgroundColor = UIColor.clearColor() | |
| } |
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
| self.definesPresentationContext = YES; | |
| presentedController.view.backgroundColor = [YOUR_COLOR with alpha OR clearColor] | |
| presentedController.modalPresentationStyle = UIModalPresentationOverCurrentContext; | |
| [self presentViewController:presentedController animated:YES completion:nil]; |
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
| // Scrollview.tag will equal to your collection view's tag | |
| // Use page to update page control or whatever | |
| func scrollViewDidEndDecelerating(scrollView: UIScrollView) { | |
| print("tag = \(scrollView.tag)") | |
| let pageWidth = scrollView.frame.size.width | |
| let page = Int(floor((scrollView.contentOffset.x - pageWidth / 2) / pageWidth) + 1) | |
| print("page = \(page)") | |
| } |
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
| Store section header in an array and change their value :) | |
| Ooops, I think dictionary is better hehe | |