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 functools | |
import inspect | |
import os | |
import warnings | |
class _DeprecatedDecorator(object): | |
MESSAGE = "%s is @deprecated" | |
def __call__(self, symbol): |
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
class ViewController: UIViewController { | |
var aplysia: Aplysia? | |
@IBAction func touchSiphon(_ sender: Any) { | |
self.aplysia!.siphon.touch() | |
} | |
override func viewDidLoad() { | |
super.viewDidLoad() |
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
class Neuron { | |
var incomingNeurons: [Neuron] = [] | |
var outcomingNeurons: [Neuron] = [] | |
var releasableSynapticVesicles: Int = 1000 | |
private weak var timer: Timer? | |
init() { | |
Timer.scheduledTimer(withTimeInterval: 5, repeats: true, block: { _ in | |
self.replenishSynapticVesicles() | |
}) |
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
func submitButtonPressed { | |
showLoadingWheel() | |
defer { hideLoadingWheel() } | |
guard let username = validateInput() else { | |
showErrorAlert() | |
return | |
} | |
let payload = ["username": username]; | |
webService.sendPOSTRequest(withPayload: payload) |
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
func submitButtonPressed { | |
showLoadingWheel() | |
defer { hideLoadingWheel() } | |
guard validateInput() else { | |
hideLoadingWheel() | |
showErrorAlert() | |
return | |
} | |
} |
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
func performPreflightCheck -> Bool { | |
guard let fuelTank = self.fuelTank else { return false } | |
guard fuelTank.fuel.type == .jetFuel else { return false } | |
let destination = self.flightPlan.dest | |
let origin = self.flightPlan.origin | |
let distance = origin.distanceFrom(destination) | |
let currentFuelLevel = fuelTank.level | |
let currentBodyWeight = hardwareService.currentWeight | |
let windSpeed = WeatherService.averageWindSpeed(forFlightPlan:flightPlan) |
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
func performPreflightCheck -> Bool { | |
return checkFuelTank() && checkWeather() && checkEngines() && checkGPS() && checkLandingGears() | |
} |
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
#!/bin/sh | |
UNIVERSAL_OUTPUTFOLDER=${BUILD_DIR}/${CONFIGURATION}-universal | |
# make sure the output directory exists | |
mkdir -p "${UNIVERSAL_OUTPUTFOLDER}" | |
# Step 1. Build Device and Simulator versions | |
xcodebuild -target "${PROJECT_NAME}" ONLY_ACTIVE_ARCH=NO -configuration ${CONFIGURATION} -sdk iphoneos BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build | |
xcodebuild -target "${PROJECT_NAME}" -configuration ${CONFIGURATION} -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build |
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
func testMeToo() { | |
var optional: Bool? | |
let value = uw(optional) // instead of using "let value = optional!" | |
XCTAssertTrue(value) | |
} |
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
func testMe() { | |
let array = [1, 2, 3] | |
let b = g(array, at: 5) // instead of using a[5] | |
XCTAssertEqual(1, b) | |
} |
NewerOlder