Skip to content

Instantly share code, notes, and snippets.

View longlongjump's full-sized avatar

Eugene Ovchynnykov longlongjump

View GitHub Profile
extension UITableViewCell {
@objc func toggleDisclosureIndicator(show: Bool) {
guard #available(iOS 13, *) else {
self.accessoryType = show ? .disclosureIndicator : .none
return
}
guard show else {
accessoryView = nil
return
//
// UIView+Utils.swift
// void
//
// Created by Eugen Ovchynnykov on 1/8/16.
//
import UIKit
extension UIView {
{
"name": "ReactiveCocoa",
"version": "4.2.2",
"summary": "A framework for composing and transforming streams of values.",
"description": "ReactiveCocoa (RAC) is an Objective-C framework for Functional Reactive Programming.\nIt provides APIs for composing and transforming streams of values.",
"homepage": "https://github.com/ReactiveCocoa/ReactiveCocoa",
"license": {
"type": "MIT",
"file": "LICENSE.md"
},
// Main idea is to choose two privot elements(lesser pviot and greater pivot) and then divide array in 3 parts:
// 1 part - elements < lesser pviot
// 2 part - elements > lesser pviot && elements < greater pivot
// 3 part - elements > greater pivot
// and then recursievly sort these parts
extension MutableCollectionType where Self.Generator.Element: Comparable, Self.Index: RandomAccessIndexType {
mutating func swap(src src: Self.Index, dest: Self.Index) {
let tmp = self[dest]
func swap<T>(inout arr: [T], src: Int, dest: Int) {
let tmp = arr[dest]
arr[dest] = arr[src]
arr[src] = tmp
}
func quicksort<T: Comparable>(inout arr: [T]) {
if arr.count < 2 {
return
}
func foo<T: Comparable>(val: T) {
debugPrint(val) // breakpoint here
}
foo(42)
foo(42.0)
foo("42")
// foo(42)
movq __TMdSi@GOTPCREL(%rip), %rsi // assigning of direct type metadata for Swift.Int to argument register\
leaq -8(%rbp), %rax // assigning stack adress to $rax
movq $42, -8(%rbp) // move 42 to stack
movq %rax, %rdi // assigning address of 42 to function arg
callq __TF4test4testurFq_T_ // test.test <A> (A) -> () function call to test<T>(val: T) with Int
////////////////////////////////////////////////////////////////////////
func foo<T>(val: T) {
debugPrint(val) // breakpoint here
}
foo(42)
foo(42.0)
foo("42")
func foo<T>(val: T) {
debugPrint(val) // breakpoint here
}
foo(42)
// test.swift
func foo<T>(val: T) {
debugPrint("func foo<T>(val: T)")
}
func foo(val: Int) {
debugPrint("func foo(val: Int)")
}