Skip to content

Instantly share code, notes, and snippets.

View longlongjump's full-sized avatar

Eugene Ovchynnykov longlongjump

View GitHub Profile
@longlongjump
longlongjump / BlurredView.h
Last active April 6, 2020 14:56
"dynamic" blur using layer mask
#import <UIKit/UIKit.h>
@interface BlurredView : UIView
-(void)update;
@end
extension UITableViewCell {
@objc func toggleDisclosureIndicator(show: Bool) {
guard #available(iOS 13, *) else {
self.accessoryType = show ? .disclosureIndicator : .none
return
}
guard show else {
accessoryView = nil
return
class OverlayView: UIView {
weak var targetView: UIView?
override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) {
super.touchesBegan(touches, withEvent: event)
targetView?.touchesBegan(touches, withEvent: event)
}
override func touchesMoved(touches: Set<UITouch>, withEvent event: UIEvent?) {
super.touchesMoved(touches, withEvent: event)
//
// 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
}
// 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: Comparable>(val: T) {
debugPrint(val) // breakpoint here
}
foo(42)
foo(42.0)
foo("42")
func foo<T>(val: T) {
debugPrint(val) // breakpoint here
}
foo(42)
foo(42.0)
foo("42")