Skip to content

Instantly share code, notes, and snippets.

View Pash237's full-sized avatar

Pavel Alexeev Pash237

View GitHub Profile
@dive
dive / xed_xcode_invocation_tool.md
Last active July 27, 2023 15:23
Xcode invocation tool - xed

Xcode invocation tool - xed

xed is a command-line tool that launches the Xcode application and opens the given documents (xcodeproj, xcworkspace, etc.), or opens a new document, optionally with the contents of standard input.

If you work from the command line, this tool is a better option than open (which can open Xcode projects as well). Why?

  • xed knows about the current selected Xcode version (open behaves unpredictably if you have multiple Xcode installed)
  • You can use it open all files from a specific commit (with a little help explained below). It is useful on code-reviews or when you want to explore significant changes in the repository
  • You can use it as a "quick open" helper. Helps with monorepo phenomena, when you have hundreds of projects in the repository (I will show you an example below)
@jfuellert
jfuellert / ScrollableView.swift
Last active April 11, 2024 17:57
A scrollable SwiftUI view, UIScrollView wrapper. ScrollableView lets you read and write content offsets for scrollview in SwiftUI, with and without animations.
import SwiftUI
struct ScrollableView<Content: View>: UIViewControllerRepresentable, Equatable {
// MARK: - Coordinator
final class Coordinator: NSObject, UIScrollViewDelegate {
// MARK: - Properties
private let scrollView: UIScrollView
var offset: Binding<CGPoint>

Упал с высоты в Турции 24 сентября 2019, был вывих и перелом большеберцовой кости в голеностопе со смещением. В больнице турки сделали операцию, зафиксировали отломок биодеградируемыми винтами, голеностоп зафиксировали аппаратом внешней фиксации вместо гипса. Но в результате отколок сместился и срастается в смещённом положении.

В РНИИТО им. Р.Р. Вредена сказали, что повторную операцию делать уже поздно. Суставная поверхность сильно повреждена, так что скорее всего сустав долго не протянет и нужно морально готовится к артродезу. Про эндопротезы для голеностопа сказали, что они очень недолговечные и нет смысла мне, молодому, такой ставить. Заключение из Вредена.

На данный момент аппарат внешней фиксации демонтирован, ногу разрабатываю.


Обследования:

МРТ (19 ноября 2020):

@Amzd
Amzd / PreferenceUIHostingController.swift
Last active September 8, 2023 12:14
PreferenceUIHostingController. Adds hiding home indicator and deferring system edge gestures to SwiftUI. (Don't work at the same time but I think that's normal?)
extension View {
/// Controls the application's preferred home indicator auto-hiding when this view is shown.
func prefersHomeIndicatorAutoHidden(_ value: Bool) -> some View {
preference(key: PreferenceUIHostingController.PrefersHomeIndicatorAutoHiddenPreferenceKey.self, value: value)
}
/// Controls the application's preferred screen edges deferring system gestures when this view is shown. Default is UIRectEdgeNone.
func edgesDeferringSystemGestures(_ edge: UIRectEdge) -> some View {
preference(key: PreferenceUIHostingController.PreferredScreenEdgesDeferringSystemGesturesPreferenceKey.self, value: edge)
}
@Amzd
Amzd / Binding+didSet.swift
Last active September 20, 2023 05:27
SwiftUI Binding wrappers for willSet and didSet
extension Binding {
/// Wrapper to listen to didSet of Binding
func didSet(_ didSet: @escaping ((newValue: Value, oldValue: Value)) -> Void) -> Binding<Value> {
return .init(get: { self.wrappedValue }, set: { newValue in
let oldValue = self.wrappedValue
self.wrappedValue = newValue
didSet((newValue, oldValue))
})
}
@pteasima
pteasima / OnScroll.swift
Last active December 16, 2020 17:35
SwiftUI onScroll
import SwiftUI
import Combine
struct OnScroll: ViewModifier {
@Binding var offset: CGFloat
//we can have a version with a closure instead of the binding, but that triggers an infinite loop if content depends on the same Store
// var onOffset: (CGFloat) -> ()
func body(content: Content) -> some View {
return VStack {
//
// FreeDrawingImageView.swift
//
// Created by Besher on 2018-12-30.
// Copyright © 2018 Besher Al Maleh. All rights reserved.
//
import UIKit
class FreeDrawingImageViewDrawLayer: UIView {
@MTuner
MTuner / fix-sublimetext-subpixel.txt
Last active March 31, 2023 21:44
Fixing font rendering/aliasing in Sublime Text in MacOS Mojave
Apple removed colored sub-pixel antialiasing in MacOS Mojave
(https://developer.apple.com/videos/play/wwdc2018/209/ starting from ~28min)
To make fonts look normal in Sublime Text, add to Preferences:
// For the editor
"font_options": [ "gray_antialias" ],
// For the sidebar / other elements
"theme_font_options": [ "gray_antialias" ],
@yageek
yageek / Simplify.swift
Created June 14, 2018 12:40 — forked from lachlanhurst/Simplify.swift
Simplification of a 3D polyline using the Ramer–Douglas–Peucker algorithm in Swift
//
// Simplify.swift
//
// Simplification of a 3D-polyline.
// A port of https://github.com/hgoebl/simplify-java for Swift
//
//
// The MIT License (MIT)
//
// Created by Lachlan Hurst on 10/02/2015.
@Pash237
Pash237 / remove_google_photos.js
Last active June 27, 2020 13:58
Script to remove Nikon SnapBridge images from Google Photos
#!/usr/bin/env node
var fs = require("fs");
var argv = process.argv.slice(2);
var exec = require('await-exec');
class Photo {
constructor(id) {
this.id = id;
this.filename = null;