Skip to content

Instantly share code, notes, and snippets.

Felix M. fxm90

Block or report user

Report or block fxm90

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@fxm90
fxm90 / WebViewExampleViewController.swift
Last active Aug 5, 2019
Show progress of WKWebView in UIProgressBar that is attached to an UINavigationBar
View WebViewExampleViewController.swift
//
// WebViewExampleViewController.swift
//
// Created by Felix Mau on 06.01.18.
// Copyright © 2018 Felix Mau. All rights reserved.
//
import UIKit
import WebKit
@fxm90
fxm90 / Observable.swift
Last active Jun 16, 2019
A lightweight implementation of an observable sequence that you can subscribe to.
View Observable.swift
//
// For reusability reasons I've moved the code into a Framework.
// https://github.com/fxm90/LightweightObservable
//
@fxm90
fxm90 / NotificationTestCase.swift
Last active May 30, 2019
XCTest - Assert notification (not) triggered.
View NotificationTestCase.swift
import XCTest
class NotificationTestCase: XCTestCase {
func testTriggerNotification() {
expectation(forNotification: .fooBar,
object: nil,
handler: nil)
let notificationCenter = NotificationCenter.default
@fxm90
fxm90 / UIView+AnimateIsHidden.swift
Last active May 21, 2019
Animate the `alpha` value of a UIView and update the `isHidden` flag accordingly.
View UIView+AnimateIsHidden.swift
//
// UIView+AnimateIsHidden.swift
//
// Created by Felix Mau on 17/12/18.
// Copyright © 2018 Felix Mau. All rights reserved.
//
import UIKit
extension UIView {
@fxm90
fxm90 / VerticalGradientImageView.swift
Last active Feb 11, 2019
An image view containing a vertical gradient as background.
View VerticalGradientImageView.swift
//
// VerticalGradientImageView.swift
//
// Created by Felix Mau on 23/09/18.
// Copyright © 2018 Felix Mau. All rights reserved.
//
import UIKit
class VerticalGradientImageView: UIImageView {
@fxm90
fxm90 / String+Log.swift
Last active Feb 11, 2019
A simple log extension on `String` using literal expressions
View String+Log.swift
//
// String+Log.swift
//
// Created by Felix Mau on 16/09/18.
// Copyright © 2018 Felix Mau. All rights reserved.
//
import Foundation
extension String {
@fxm90
fxm90 / CustomNotificationCenterTestCase.swift
Created Aug 6, 2018
XCTest - Use custom notification center in test case and assert notification (not) triggered.
View CustomNotificationCenterTestCase.swift
class CustomNotificationCenterTestCase: XCTestCase {
var notificationCenter: NotificationCenter!
override func setUp() {
super.setUp()
notificationCenter = NotificationCenter()
}
@fxm90
fxm90 / isNumeric.php
Last active Apr 28, 2018
Checks whether all given parameters are numeric (Same as php-vanilla "is_numeric" but as variadic function).
View isNumeric.php
// 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;
}
@fxm90
fxm90 / UIColor+Initializers.swift
Last active Mar 28, 2018
Create UIColor from RGB, RGBA, Hex or Hex-String ("#ffffff")
View UIColor+Initializers.swift
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)
///
@fxm90
fxm90 / NotificationCenter+ObserveOnce.swift
Last active Dec 27, 2017
Extension for "NotificationCenter" to observe a notification just once and directly unsubscribe.
View NotificationCenter+ObserveOnce.swift
extension NotificationCenter {
/// Adds an observer to the given notification center, which fires just once.
///
/// Note:
/// - Same parameters as "addObserver", but with default properties
/// See http://apple.co/2zZIYJB for details.
///
/// Parameters:
/// - name: The name of the notification for which to register the observer
You can’t perform that action at this time.