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 UIKit | |
import PlaygroundSupport | |
let page = PlaygroundPage.current | |
page.needsIndefiniteExecution = true | |
func palindrome(for string: String) -> Bool { | |
let arr = Array(string.lowercased()) | |
// NOTE: from the natural language point of view empty string - is not a palindrome |
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 UIKit | |
extension UIApplication { | |
// MARK: Public | |
func isRunningInTestFlightEnvironment() -> Bool { | |
if isSimulator() { | |
return false | |
} else { | |
if isAppStoreReceiptSandbox() && !hasEmbeddedMobileProvision() { |
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
[ | |
{"locale_key": "bs", "Marathi": "Bosnian", | |
"capital": { | |
"name": "New Delhi", | |
"latitude": 28.6357600, | |
"longitude": 77.2244500 | |
} | |
}, | |
{"locale_key": "ee_TG", "Marathi": "Ewe (Togo)", | |
"capital": { |
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 CoreData | |
import Foundation | |
// NOTE: use manual / none code generation - | |
// it give full controll over models properties(custom getters + setters) + model lifecycle | |
// To create a new model class: | |
// 1. Focus on core data model class | |
// 2. XCode -> Editor -> Create NSManagedObject Subclass | |
// 3. Select an appropriate model from database scheme and create a class |
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 CoreData | |
import Foundation | |
extension CoreDataManager { | |
/** | |
User profile (id, email, phone, picture_url, social links and ect.) | |
*/ | |
var myProfileSettings: MyProfileSettings? { | |
get { |
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 UIKit | |
extension UITableView { | |
func isCellVisible(section: Int, row: Int) -> Bool { | |
guard let indexes = self.indexPathsForVisibleRows else { | |
return false | |
} | |
return indexes.contains{ $0.section == section && $0.row == row } | |
} |
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 Moya | |
typealias DataUpdateInfo = [AnyHashable: [String: Any]] | |
protocol JSONAble where Self: Codable { | |
func toJSON() -> [String: Any] | |
static func fromJSON(_ dictionary: [AnyHashable: Any]) -> Self? | |
func toMultipartData() -> [Moya.MultipartFormData]? |
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 Rswift // pod 'R.swift' | |
typealias Localizable = R.string.localizable | |
// NOTE: Contains accesibility identifiers (XCUITest) + accesibility labels (Voice over support) | |
struct Accessibility { | |
// MARK: Chat navigation bar | |
static let chatNavigationUserProfileImageId = "ChatNavigationBar.chatOpponentAvatar" |
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
@UIApplicationMain | |
class AppDelegate: UIResponder, UIApplicationDelegate { | |
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { | |
// Override point for customization after application launch. | |
var testStr = "" | |
var testStr2 = "131231" | |
testStr.test = 20 |
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
http://www.sql-ex.ru/learn_exercises.php | |
Description | |
The firm owns several buy-back centers for collection of recyclable materials. Each of them receives funds to be paid to the recyclables suppliers. Data on funds received is recorded in the table | |
Income_o(point, date, inc) | |
The primary key is (point, date), where point holds the identifier of the buy-back center, and date corresponds to the calendar date the funds were received. The date column doesn’t include the time part, thus, money (inc) arrives no more than once a day for each center. Information on payments to the recyclables suppliers is held in the table | |
Outcome_o(point, date, out) | |
In this table, the primary key (point, date) ensures each buy-back center reports about payments (out) no more than once a day, too. | |
For the case income and expenditure may occur more than once a day, another database schema with tables having a primary key consisting of the single column code is used: |