Skip to content

Instantly share code, notes, and snippets.

View dmpv's full-sized avatar

Dmitry Purtov dmpv

  • Moscow, Russia
View GitHub Profile
@dmpv
dmpv / interview.md
Last active February 22, 2023 19:14
iOS Basic Interview

#iOS Interview

1. Snippets

  • Какие есть проблемы с этим кодом?
// OTTAvatarView.h

#import <UIKit/UIKit.h>
@dmpv
dmpv / main.md
Last active June 30, 2016 17:12
iOS Debugging

###Object introspection

- (id)_shortMethodDescription;
- (id)_methodDescription;
- (id)__methodDescriptionForClass:(Class)arg1;
- (id)_ivarDescription;
- (id)__ivarDescriptionForClass:(Class)arg1;
@dmpv
dmpv / main.md
Last active October 7, 2016 15:47
Repo Decoration
@dmpv
dmpv / tweaks_scheme_example.md
Created November 20, 2016 20:59
FBTweaks Autocompletion/Typechecking Tools

##Primary Way

#define str_mk(name, ...) _##name; struct { char __VA_ARGS__; } name; char __##name
#define _(name, ...) char str_mk(name, ##__VA_ARGS__);
#define __(name, ...) str_mk(name, ##__VA_ARGS__)
#define ___(name, ...) str_mk(name, ##__VA_ARGS__)
#define ____(name) str_mk(name, dummy)

_(OTTDefaultTweakLib,
@dmpv
dmpv / Branching.md
Last active December 14, 2016 17:56
Git Cases

Pick the range of commits (from A to B inclusive) from source branch and apply to destination branch

  • cherry-pick

    • git cherry-pick A~..B or
    • git cherry-pick A^..B (NB: Use A\\^ when using Oh-My-ZSH)
  • rebase
    0. Checkout a new temporary branch at the current location
    git checkout -b tmp

  1. Move the destination branch to the head of the new patchset
static const char kNotAParen = 0;

static inline BOOL isOpenParen(char paren) {
    return paren == '[' || paren == '(' || paren == '{';
}

static inline BOOL isCloseParen(char paren) {
    return paren == ']' || paren == ')' || paren == '}';
@dmpv
dmpv / chat-structure.md
Last active March 19, 2020 01:39
SC Chat Structure

Structure

Entities

  • Message<ContentT> (заворачиваем в AnyMessage)
  • ChatNotification
  • ChatAccessory

Models

  • MessageStore — основная модель. Redux Store (cостоит из компонент State, Action и Reducer). Для удобста компоненты разбиты на Local и Feed составляющие. Принцип работы:
  1. Клиент посылает экшн стору: store.dispatch(.someAction(someParam))

Airbnb Swift Style Guide

@dmpv
dmpv / 1-view-styling.md
Last active April 20, 2020 12:23
UI Development

Styling Kit

Consists of Style (just a function) and UIView extension

public typealias Style<ViewT> = (ViewT) -> Void

public protocol Stylable {}

public extension Stylable {
    @discardableResult
@dmpv
dmpv / TemplateView.swift
Created July 22, 2020 15:43
Component Templates
import Foundation
import UIKit
import RxSwift
import SnapKit
final class TemplateView: UIView, StatefulComponent {
var state: State? {
didSet { stateDidChange(from: oldValue) }
}