Skip to content

Instantly share code, notes, and snippets.

View bugrym's full-sized avatar
🥋
Focusing

Vladyslav bugrym

🥋
Focusing
  • Ukraine
View GitHub Profile
@bugrym
bugrym / ScrollViewLayout
Created September 4, 2020 10:04
ScrollViewLayout
ScrollView:
leading & trailing constraints to safe area
top & bottom constraints to super view
ContainerView:
leading, trailing, top, bottom constraints to super view (ScrollView)
equal width to super view (ScrollView)
center vertically(Y) to super view (ScrollView)
@bugrym
bugrym / UIView + Extension
Created August 4, 2020 07:40
Extension for UIView with all parameters
extension UIView {
public var width:CGFloat {
return self.frame.size.width
}
public var height:CGFloat {
return self.frame.size.height
}
@bugrym
bugrym / passport_validation_regex_expression
Last active July 21, 2020 10:21
Passport Series Validation
^[A-Z](?:[A-Z][0-9]{0,6})?$ regex for validate passport series format: XX000000
let validatedString = NSPredicate(format:"SELF MATCHES %@", validationExpression)
return validatedString.evaluate(with: text)
@bugrym
bugrym / stackDataStructure
Created June 15, 2020 14:39
Generic stack data structure
public struct Stack<Element> {
private var elements:[Element] = []
public var isEmpty:Bool {
peek() == nil
}
public init() { }
public mutating func push(_ element:Element) {
@bugrym
bugrym / exponentiating
Created June 15, 2020 06:30
Universal exponentiating method
func multiplicatorWith(base:Int, rate:Int) -> Int {
var initialValue = base
for _ in 1..<rate {
initialValue *= base
}
OR
for _ in 0..<(rate - 1) {
initialValue *= base
@bugrym
bugrym / TestFlightSteps
Created June 2, 2020 10:45
Add a new tester to TestFlight
1. App Store Connect
2. Users and Access
3. Tap +
4. Send an invite and add new user to App Store Connect
5. App Store Connect -> My Apps
6. App Store Connect Users
7. Tap + to add a new tester to App
@bugrym
bugrym / Adaptive ScrollView
Created March 25, 2020 12:10
Adaptive ScrollView
//
// AdaptiveScroll.swift
// RatingApp
//
// Created by Vladyslav Bugrym on 25.03.2020.
// Copyright © 2020 admin. All rights reserved.
//
import UIKit
@bugrym
bugrym / leetCode3
Created February 21, 2020 09:26
1295. Find Numbers with Even Number of Digits
func findNumbers(_ nums: [Int]) -> Int {
var res = 0
if nums.count >= 1 && nums.count <= 500 {
nums.map {
if $0 >= 1 && $0 <= 100000 {
var givenNum = $0
var digits:[Int] = []
repeat {
@bugrym
bugrym / leetCode2
Created February 21, 2020 08:50
1281. Subtract the Product and Sum of Digits of an Integer
func subtractProductAndSum(_ n: Int) -> Int {
var givenNum = n
var num:[Int] = []
if n >= 1 && n <= 100000 {
repeat {
let digit = givenNum%10
givenNum /= 10
num.append(digit)
} while (givenNum != 0)
@bugrym
bugrym / leetCode1
Created February 20, 2020 15:56
1108. Defanging an IP Address
func defangIPaddr(_ address: String) -> String {
return address.replacingOccurrences(of: ".", with: "[.]")
}