override func viewWillAppear(animated: Bool) {
super.viewWillAppear(animated)
subscribeToKeyboardNotifications()
}
override func viewWillDisappear(animated: Bool) {
super.viewWillDisappear(animated)
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
| // | |
| // ArrayExtension.swift | |
| // Brings sample() to swift | |
| // | |
| // Created by Abdullah on 10/3/16. | |
| // | |
| import Foundation | |
| extension Array { |
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
| # use -n to set number of reqs, and -c concurrent req at a time. | |
| ab -n 5000 -c 20 http://example.com/ |
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
| @mixin no-select { | |
| -webkit-user-select: none; | |
| -moz-user-select: none; | |
| -ms-user-select: none; | |
| user-select: none; | |
| } |
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
| // | |
| // Convert string to a proper formatted date type. | |
| // | |
| // Swift 3.0 | |
| private func stringToDate(dateString: String?) -> Date? { | |
| if let str = dateString { | |
| let formatter = DateFormatter() | |
| formatter.dateFormat = "MMM dd, yyyy h:mm a" | |
| formatter.amSymbol = "AM" |
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
| // | |
| // ViewControllerExtension.swift | |
| // VirtualTourist | |
| // | |
| // Created by Abdullah on 2/15/17. | |
| // | |
| import UIKit | |
| extension UIViewController { |
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
| ## | |
| ## Depends on ActiveSupport | |
| ## | |
| # Initial imple: stackoverflow.com/a/32279088 | |
| def greeting_phrase | |
| now = Time.zone.now | |
| today = Date.current.to_time | |
| morning = today.beginning_of_day | |
| noon = today.noon |
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
| # Extend in your test_helper.rb or any other `/supprot` setup you have. | |
| class ActiveSupport::TestCase | |
| ## | |
| # === NOTICE: | |
| # Ensure you have `ActionMailer::TestHelper` in the test class .. | |
| # | |
| # This method performs any enqueued job during tests manually, | |
| # Helpful when testing the queueing of your jobs then the result of their execution. |
# Runs assert_difference with a number of conditions and varying difference
# counts.
#
# Call as follows:
#
# assert_differences([['Model1.count', 2], ['Model2.count', 3]])
#
def assert_differences(expression_array, message = nil, &block)
b = block.send(:binding)