Skip to content

Instantly share code, notes, and snippets.

View surakamy's full-sized avatar

Dmytro Kholodov surakamy

View GitHub Profile
@katleta3000
katleta3000 / Mobius 2019
Last active February 29, 2024 22:08
Список материалу к докладу "Работаем с сетью эффективно" Ртищев Евгения для Mobius 2019 22-23 мая
1. Очень крутая книжка по сетям (стек OSI) – Charles Severance “Introduction to Network: How the Internet works”
2. URLCache – https://nshipster.com/nsurlcache/
3. Ресёрч HTTP-кеширования с использованием URLCache https://qnoid.com/2016/04/10/A-primer-in-HTTP-caching-and-its-native-support-by-iOS.html
4. Анализ доступности сети:
* SimplePing – https://developer.apple.com/library/archive/samplecode/SimplePing/Introduction/Intro.html
* https://github.com/dustturtle/RealReachability
* https://github.com/ankitthakur/SwiftPing
* https://github.com/lmirosevic/GBPing
* https://github.com/rwbutler/Connectivity
* Баг с 2009 года – https://lists.apple.com/archives/macnetworkprog/2009/May/msg00056.html
@tclementdev
tclementdev / libdispatch-efficiency-tips.md
Last active August 21, 2024 06:58
Making efficient use of the libdispatch (GCD)

libdispatch efficiency tips

The libdispatch is one of the most misused API due to the way it was presented to us when it was introduced and for many years after that, and due to the confusing documentation and API. This page is a compilation of important things to know if you're going to use this library. Many references are available at the end of this document pointing to comments from Apple's very own libdispatch maintainer (Pierre Habouzit).

My take-aways are:

  • You should create very few, long-lived, well-defined queues. These queues should be seen as execution contexts in your program (gui, background work, ...) that benefit from executing in parallel. An important thing to note is that if these queues are all active at once, you will get as many threads running. In most apps, you probably do not need to create more than 3 or 4 queues.

  • Go serial first, and as you find performance bottle necks, measure why, and if concurrency helps, apply with care, always validating under system pressure. Reuse

@danielctull
danielctull / UICollectionViewFlowLayout+DelegateAccess.swift
Last active May 16, 2019 14:00
Wraps the six UICollectionViewFlowLayout delegate methods and their equivalent properties using functional programming techniques, so that values are easier to retrieve. Full details at: http://danieltull.co.uk/blog/2018/04/13/simplifying-uicollectionviewflowlayout-delegate-method-usage-with-functional-programming/
extension UICollectionViewFlowLayout {
typealias DelegateMethod<Key, Value> = ((UICollectionView, UICollectionViewLayout, Key) -> Value)
private var delegate: UICollectionViewDelegateFlowLayout? {
return collectionView?.delegate as? UICollectionViewDelegateFlowLayout
}
func retrieve<Key, Value>(
@wojteklu
wojteklu / clean_code.md
Last active September 1, 2024 05:42
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@andymatuschak
andymatuschak / States-v3.md
Last active August 26, 2024 23:01
A composable pattern for pure state machines with effects (draft v3)

A composable pattern for pure state machines with effects

State machines are everywhere in interactive systems, but they're rarely defined clearly and explicitly. Given some big blob of code including implicit state machines, which transitions are possible and under what conditions? What effects take place on what transitions?

There are existing design patterns for state machines, but all the patterns I've seen complect side effects with the structure of the state machine itself. Instances of these patterns are difficult to test without mocking, and they end up with more dependencies. Worse, the classic patterns compose poorly: hierarchical state machines are typically not straightforward extensions. The functional programming world has solutions, but they don't transpose neatly enough to be broadly usable in mainstream languages.

Here I present a composable pattern for pure state machiness with effects,

protocol Reusable{
static var reuseIdentifier: String { get }
}
extension Reusable {
static var reuseIdentifier: String { return String(Self.self) }
}
extension UICollectionViewCell : Reusable {}
import UIKit
extension UIImage {
// colorize image with given tint color
// this is similar to Photoshop's "Color" layer blend mode
// this is perfect for non-greyscale source images, and images that have both highlights and shadows that should be preserved
// white will stay white and black will stay black as the lightness of the image is preserved
func tint(tintColor: UIColor) -> UIImage {
@alanzeino
alanzeino / lldb-debugging.md
Last active May 29, 2024 03:18
LLDB debugging with examples

LLDB Debugging Cheat Sheet

Commands

LLDB Commands

LLDB comes with a great set of commands for powerful debugging.

help

Your starting point for anything. Type help to get a list of all commands, plus any user installed ones. Type 'help for more information on a command. Type help to get help for a specific option in a command too.

@jkereako
jkereako / ios-developer-reading-list.md
Last active January 15, 2024 14:23
This is a list of documents I have read and plan to read. Speaking from experience, if you take the time to pour over these documents and take notes on topics of interest, you will greatly improve your skill.

iOS developer reading list

The best way to learn and master iOS development is to read the official documentation. It can be boring but you can trust its accuracy and the information will be presented without opinion.

Read documents in order where indicated.

Topics

@staltz
staltz / introrx.md
Last active August 30, 2024 13:50
The introduction to Reactive Programming you've been missing