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 CustomNotificationCenterTestCase: XCTestCase { | |
var notificationCenter: NotificationCenter! | |
override func setUp() { | |
super.setUp() | |
notificationCenter = NotificationCenter() | |
} |
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 XCTest | |
class NotificationTestCase: XCTestCase { | |
func testTriggerNotification() { | |
expectation(forNotification: .fooBar, | |
object: nil, | |
handler: nil) | |
let notificationCenter = NotificationCenter.default |
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
// | |
// WebViewExampleViewController.swift | |
// | |
// Created by Felix Mau on 06.01.18. | |
// Copyright © 2018 Felix Mau. All rights reserved. | |
// | |
import UIKit | |
import WebKit |
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
SWIFTLINT="${PODS_ROOT}/SwiftLint/swiftlint" | |
if [ ! -f "$SWIFTLINT" ]; then | |
echo "warning: SwiftLint not installed!" | |
exit 1 | |
fi | |
$SWIFTLINT |
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
// | |
// NotificationCenter+ObserveOnce.swift | |
// | |
// Created by Felix Mau on 18.10.20. | |
// Copyright © 2020 Felix Mau. All rights reserved. | |
// | |
import UIKit | |
extension NotificationCenter { |
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
// Checks whether all given parameters are numeric. | |
// Usage: $validCoordinates = isNumeric($_GET['p1Lat'], $_GET['p1Lon'])); | |
function isNumeric() { | |
$numberOfArguments = func_num_args(); | |
$arguments = func_get_args(); | |
return count(array_filter($arguments, 'is_numeric')) === $numberOfArguments; | |
} |
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
// Returns a random float value between "$min" and "$max". | |
// Usage: $latitude = randomFloat(53.394655, 53.694865) | |
function randomFloat($min, $max) { | |
return $min + lcg_value() * abs($max - $min); | |
} | |
// Returns a random argument, passed to this function. | |
// Usage: $fruit = randomArgument('Apple', 'Banana', 'Strawberry'); | |
function randomArgument() { | |
$numberOfArguments = func_num_args(); |
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 isset(_ args: Any?...) -> Bool { | |
return !args.contains { $0 == 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
class Deferred { | |
constructor() { | |
this.promise = new Promise((resolve, reject) => { | |
this.reject = reject; | |
this.resolve = resolve; | |
}); | |
} | |
resolve(value) { | |
this.resolve(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
public extension UIColor { | |
/// Create color from RGB(A) | |
/// | |
/// Parameters: | |
/// - absoluteRed: Red value (between 0 - 255) | |
/// - green: Green value (between 0 - 255) | |
/// - blue: Blue value (between 0 - 255) | |
/// - alpha: Blue value (between 0 - 255) | |
/// |