Skip to content

Instantly share code, notes, and snippets.

View Vladlex's full-sized avatar

Alexey Gordeev Vladlex

  • Dialog
  • Moscow
View GitHub Profile
@Vladlex
Vladlex / gist:ea02dba926feeb369edd621be424dc52
Created December 5, 2017 21:24
RxSwift Extension: Collect until no event comes in a given time interval
public extension Observable {
/// Returns an observable which collects incoming events and fires if no new event comes in a desired time
///
/// - Parameters:
/// - delay: Value for debouncing (interval that should being passed, a)
/// - bufferMutator: block to mutate collected events. If nil – then new evens just being added to buffer.
/// - Returns: an observable which collects incoming events and fires if no new event comes in a desired time.
public func collect(untilNoEventComesIn delay: RxTimeInterval, bufferMutator:((inout [E], E)->())? = nil) -> Observable<[E]> {
#21. Crashed: com.apple.mobileslideshow.accessCallbacks
0 libsystem_kernel.dylib 0x19e9dd104 __pthread_kill + 8
1 libsystem_pthread.dylib 0x19ea5ca00 pthread_kill$VARIANT$armv81 + 296
2 libsystem_c.dylib 0x19e934d78 abort + 140
3 libswiftCore.dylib 0x1063af07c swift::warning(unsigned int, char const*, ...) + 54
4 libswiftCore.dylib 0x1063af180 swift::swift_abortRetainUnowned(void const*) + 32
5 libswiftCore.dylib 0x1063e0968 swift_unknownUnownedTakeStrong + 70
6 DLGPicker 0x100c631cc partial apply for closure #1 in TelegramPickerViewController.checkStatus() (TelegramPickerViewController.swift:491)
7 DLGPicker 0x100bda3a8 closure #1 in static Assets.requestAccess(_:) (Assets.swift:89)
8 DLGPicker 0x100bda3dc _T0SC21PHAuthorizationStatusOIegy_ABIeyBy_TR (Assets.swift)
@Vladlex
Vladlex / UIImage+Flip.swift
Created June 22, 2019 08:57
UIImage Flip
public extension UIImage {
public struct FlipOptions: OptionSet {
public typealias RawValue = Int
public let rawValue: RawValue
public init(rawValue: RawValue) {
self.rawValue = rawValue
import UIKit
struct GuiUtils {
static func setAttributedStringToSize(attributedString: NSAttributedString, size: CGFloat) -> NSMutableAttributedString {
let mus = NSMutableAttributedString(attributedString: attributedString)
mus.enumerateAttribute(.font, in: NSRange(location: 0, length: mus.string.count)) { (value, range, stop) in
if let oldFont = value as? UIFont {
let newFont = oldFont.withSize(size)
mus.addAttribute(.font, value: newFont, range: range)
@Vladlex
Vladlex / ReduceTests.swift
Last active May 27, 2020 11:24
Comparing different reduce algorithms
// ReduceTests.swift
// Created by Gordeev Aleksey on 27.05.2020.
import XCTest
@testable import ReduceTesting
extension Sequence {
func reduce<Result>(
_ initialResult: Result,
_ nextPartialResult: (Result, Self.Iterator.Element) throws -> Result,
CDN: trunk Redirecting from https://cdn.cocoapods.org/Specs/a/e/b/RSKImageCropper/0.1.0/RSKImageCropper.podspec.json to https://cdn.jsdelivr.net/cocoa/Specs/a/e/b/RSKImageCropper/0.1.0/RSKImageCropper.podspec.json
CDN: trunk Redirecting from https://cdn.cocoapods.org/Specs/a/e/b/RSKImageCropper/1.1.2/RSKImageCropper.podspec.json to https://cdn.jsdelivr.net/cocoa/Specs/a/e/b/RSKImageCropper/1.1.2/RSKImageCropper.podspec.json
CDN: trunk Redirecting from https://cdn.cocoapods.org/Specs/a/e/b/RSKImageCropper/1.1.1/RSKImageCropper.podspec.json to https://cdn.jsdelivr.net/cocoa/Specs/a/e/b/RSKImageCropper/1.1.1/RSKImageCropper.podspec.json
CDN: trunk Redirecting from https://cdn.cocoapods.org/Specs/a/e/b/RSKImageCropper/1.0.0/RSKImageCropper.podspec.json to https://cdn.jsdelivr.net/cocoa/Specs/a/e/b/RSKImageCropper/1.0.0/RSKImageCropper.podspec.json
CDN: trunk Redirecting from https://cdn.cocoapods.org/Specs/a/e/b/RSKImageCropper/1.2.0/RSKImageCropper.podspec.json to https://cdn.jsdelivr.net/cocoa/Specs/a/e
@Vladlex
Vladlex / gist:5a8f7fc9b9d85dc87dfd5108ff6ba959
Created May 16, 2021 12:31
JSONSmart - Simplified work with json
//
// JSONSmart.swift
//
//
// Created by Aleksei Gordeev on 06.03.2021.
//
import Foundation
/// Simplifies the JSON content access. Inspired by SwiftyJSON.