Skip to content

Instantly share code, notes, and snippets.

import UIKit
public final class ChipsContainerView: NiblessView {
enum Style {
case withIcon, titleOnly
}
{"meta":{"currencyName":"Current","currencySymbol":"UAH","appVersion":"Budger_1.0_8","exportServiceVersion":"1.0 (2)"},"savings":[{"currencyName":"US Dollar","title":"Моно ФОП","timestamp":638103770.92732596,"currencySymbol":"$","transactions":[{"value":601,"timestamp":638103772.96882999,"comment":"На налоги за прошлые месяца","type":2},{"value":5808,"timestamp":638103827.46319306,"comment":"Гонорар","type":2},{"value":379,"timestamp":638103844.23841798,"comment":"Коворкинг","type":1},{"value":2000,"timestamp":638103961.58647597,"comment":"На депозит","type":1}]},{"currencyName":"US Dollar","title":"Наличные","timestamp":638104058.87994599,"currencySymbol":"$","transactions":[{"value":1020,"timestamp":638104201.46120799,"comment":"","type":2},{"value":1880,"timestamp":638104209.03474605,"comment":"","type":2},{"value":5000,"timestamp":638104303.15409303,"comment":"","type":2},{"value":250,"timestamp":638104316.73985195,"comment":"","type":2},{"value":6850,"timestamp":638104343.55056095,"comment":"","type":2}]
import UIKit
import RxSwift
public typealias Alert = UIAlertController
public final class AlertBuilder {
private struct Action {
let title: Observable<String>
@rnkyr
rnkyr / check-ats.rb
Created October 19, 2020 07:41
Updates Info.plist with ATS exceptions based on Config file
# Checks Config.plist for http urls and adds them into App Transport security of your Info.plist
INFO_PLIST = "#{ENV["BUILT_PRODUCTS_DIR"]}/#{ENV["INFOPLIST_PATH"]}"
CONFIG_PLIST = INFO_PLIST.sub(/.*\KInfo\.plist/, 'Config.plist')
PLISTBUDDY = "/usr/libexec/PlistBuddy"
lines = `#{PLISTBUDDY} #{CONFIG_PLIST} -c print | grep = | tr -d ' '`.split("\n")
urls = []
lines.each do |line|
value = line.match(/.*\=(.*)/).captures[0]
@rnkyr
rnkyr / Autolayout.swift
Last active January 11, 2021 16:18
Autolayout DSL
import UIKit
protocol LayoutAnchor {
func constraint(equalTo anchor: Self, constant: CGFloat) -> NSLayoutConstraint
func constraint(greaterThanOrEqualTo anchor: Self, constant: CGFloat) -> NSLayoutConstraint
func constraint(lessThanOrEqualTo anchor: Self, constant: CGFloat) -> NSLayoutConstraint
}
protocol LayoutDimension: LayoutAnchor {
@rnkyr
rnkyr / .gitignore
Last active January 8, 2021 11:49
Generic gitignore file I'm currently using for iOS projects
.DS_Store
# Build generated
build/
DerivedData/
# Various settings
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
import Foundation
public protocol NavigationEvent {}
public protocol NavigationEventDrivenInterface {
func raise<T: NavigationEvent>(event: T)
func addHandler<T: NavigationEvent>(_ handler: @escaping (T) -> Void)
}
@rnkyr
rnkyr / cart.rb
Created April 2, 2018 22:15
An semi-automation script for Carthage dependency manager
#!/usr/bin/ruby
# An semi-automation script for Carthage dependency manager
# It performs linking and copy-frameworks phase creation
# Basic usage examples:
# ruby ~/dev/cart.rb -d "~/Desktop/MyProject" -l
# ruby ~/dev/cart.rb -d "~/Desktop/MyProject" -tar "Core" -t "RxSwift, Bolts-Swift"
# ruby ~/dev/cart.rb -d "~/Desktop/MyProject" -s "RxSwift, Bolts-Swift"
# Or you can create a Run Script phase (in dedicated Aggregate Target) which will run carthage as well.
//
// Logger.swift
//
// Created by Roman Kyrylenko on 5/25/17.
// Copyright © 2017 pr0ctopus. All rights reserved.
//
import Foundation
#if canImport(Firebase)
@rnkyr
rnkyr / PrivacyTableViewCell.swift
Created March 15, 2018 15:31
An example on how to setup links inside UITextView
//
// PrivacyTableViewCell.swift
//
// Created by Roman Kyrylenko on 5/22/17.
// Copyright © 2017 pr0ctopus. All rights reserved.
//
private let privacyScheme = "privacy"
private let termsScheme = "terms"