Type we want to test
struct Player {
var name: String
var age: String
var address: String
var wins: Int
var losses: Int
var hasWinningRecord: Bool {
Type we want to test
struct Player {
var name: String
var age: String
var address: String
var wins: Int
var losses: Int
var hasWinningRecord: Bool {
| # | |
| # uncrustify config file for objective-c and objective-c++ | |
| # | |
| indent_with_tabs = 0 # 1=indent to level only, 2=indent with tabs | |
| output_tab_size = 4 # new tab size | |
| indent_columns = output_tab_size | |
| indent_label = 2 # pos: absolute col, neg: relative column | |
| indent_align_assign = FALSE |
| const jwt = require('express-jwt'); | |
| const getTokenFromHeaders = (req) => { | |
| const { headers: {authorization} } = req; | |
| if (authorization && authorization.split(' ')[0] === 'Token') { | |
| return authorization.split(' ')[1]; | |
| } | |
| return null |
| const express = require('express'); | |
| const path = require('path'); | |
| const bodyParser = require('body-parser'); | |
| const session = require('express-session'); | |
| const cors = require('cors'); | |
| const mongoose = require('mongoose'); | |
| const errorHandler = require('errorHandler'); | |
| //Configure mongoose's promise to global promise | |
| mongoose.promise = global.Promise; |
| class ManagedObjectContextObserver { | |
| // MARK: - Private properties | |
| private let context: NSManagedObjectContext | |
| private let notificationCenter: NotificationCenter | |
| private let notification: NSNotification.Name | |
| private let trackTypes: [NSManagedObject.Type] | |
| private let queue: DispatchQueue | |
| private var observers: [NSObjectProtocol] = [] |
| import Foundation | |
| class Restaurant { | |
| var table: Table! | |
| deinit{ print("Restaurant deinitialized") } | |
| } | |
| class Table { | |
| weak var restaurant: Restaurant! //OPTION 1 |
| // MARK: Refundable | |
| protocol Refundable { | |
| var canBeRefunded: Bool { get } | |
| var isRefunded: Bool { get } | |
| var isARefund: Bool { get } | |
| } | |
| extension Bill: Refundable { | |
| var canBeRefunded: Bool { | |
| return isClosed && !isRefunded && !isARefund |
| ` | |
| fileprivate func createOperation(for job: Job) { | |
| let jobUUID = job.objectID | |
| guard let printer = job.printer else { return } | |
| guard let operationQueue = operationQueue(of: printer) else { return } | |
| let operation = BlockOperation.init { | |
| let operationContext = FalconRecord.container.newBackgroundContext() | |
| var operationJobDidChange = false | |
| Recommendations | |
| 1. In FormOrderTableViewCell, move logic that changes color and font to awakeFromNib() | |
| 2. In OrderPickerView | |
| 2.1 Use the reset method of NSManagedObjectContext when OrderPickerView is not displayed | |
| 2.2 Change data structure of bills from [Date: [Bill]] to either [[(headerText, rows)]] or split it into 2 - headerTexts [String] and bills[[Bill]] | |
| 2.3 Instead of passing the Bill managed object to the UITableViewCell, map the values to an intermediary struct and pass that instead | |
| 2.4 Use UITableView directly and take out falcon | |
| 2.4.1 Option 1: | |
| 1. Start 2 fetches: <Fetch#1> to fetch initial objects to display(maybe the bills in the last 7 days), <Fetch#2> Fetch all bills (in the background) | |
| 2. Display <Fetch#1> right away. |
| mutation($ubimd_upsertBillItemMetaData: [CreateBillItemMetaData], $idempotentCreateBills_idempotentCreateBills: [CreateBill]) { | |
| bulk(upsertBillItemMetaData: $ubimd_upsertBillItemMetaData, idempotentCreateBills: $idempotentCreateBills_idempotentCreateBills) { | |
| upsertBillItemMetaData { | |
| _ref | |
| } | |
| idempotentCreateBills { | |
| id | |
| _ref | |
| } | |
| didSucceed |