View PlaceholderTextView.swift
This file contains 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
// | |
// PlaceholderTextView.swift | |
// talkative-iOS | |
// | |
// Created by German Lopez on 6/6/16. | |
// Copyright © 2016 Rootstrap Inc. All rights reserved. | |
// | |
import UIKit |
View AppDelegate.swift
This file contains 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
// | |
// AppDelegate.swift | |
// Adds observer to detect changes in the *rootViewController* of the main window. | |
// | |
import UIKit | |
@UIApplicationMain | |
class AppDelegate: UIResponder, UIApplicationDelegate { |
View lambda_function.rb
This file contains 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
require 'aws-sdk-ec2' | |
# You can customize the lambda function in AWS console to use ENV variables or to receive | |
# the region, tags or any identification for your EC2 instances in the event message. | |
def lambda_handler(event:, context:) | |
ec2 = Aws::EC2::Resource.new(region: 'us-east-2') | |
instances = ec2.instances(filters: [ | |
{ | |
name: "tag:Role", | |
values: ["API"], |
View Gradients.swift
This file contains 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 UIKit | |
public enum GradientDirection: Double { | |
case topToBottom = 90.0 | |
case bottomToTop = 270.0 | |
case leftToRight = 180.0 | |
case rightToLeft = 0.0 | |
} |
View EmailValidatorStringExtension.swift
This file contains 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
extension String { | |
//Regex fulfill RFC 5322 Internet Message format | |
func isEmailFormatted() -> Bool { | |
let predicate = NSPredicate(format: "SELF MATCHES %@", "[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+(\\.[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+)*@([A-Za-z0-9]([A-Za-z0-9-]*[A-Za-z0-9])?\\.)+[A-Za-z0-9]([A-Za-z0-9-]*[A-Za-z0-9])?") | |
return predicate.evaluate(with: self) | |
} | |
} |
View CALayerExtension.swift
This file contains 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 | |
extension CALayer { | |
func pause() -> TimeInterval { | |
if #available(iOS 11, *) { | |
let pausedTime = convertTime(CACurrentMediaTime(), from: nil) | |
speed = 0 | |
timeOffset = pausedTime | |
return pausedTime |
View UIScrollViewExtension.swift
This file contains 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
extension UIScrollView { | |
//MARK: Normal Scrolling | |
func didScrollBeyondTop(withThreshold minimum: CGFloat = 0) -> Bool { | |
return contentOffset.y < -minimum | |
} | |
func didScrollBeyondBottom(withThreshold minimum: CGFloat = 0) -> Bool { | |
if contentOffset.y <= 0 { return false } //Fixes UIRefreshControll initial state |
View UIScrollViewExtension.swift
This file contains 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
extension UIScrollView { | |
func scroll(toSubview view: UIView, animated: Bool = true) { | |
guard view.isDescendant(of: self) else { return } | |
let visibleRect = CGRect(origin: contentOffset, | |
size: frame.size) | |
let realRect = view.convert(view.frame, to: self | |
//View is out of scroll visible area | |
if !visibleRect.contains(realRect) || realRect.maxY <= 0 { |