Skip to content

Instantly share code, notes, and snippets.

View adriansergheev's full-sized avatar

Adrian Sergheev adriansergheev

View GitHub Profile
@adriansergheev
adriansergheev / current_selected_installed_xcode.md
Created April 1, 2025 08:02 — forked from dive/current_selected_installed_xcode.md
How to get the current selected Xcode and list installed

How to get the current selected Xcode and list installed

Current Selected Xcode

xcode-select

This is the most common way to get the path to the selected instance:

xcrun xcode-select --print-path
@adriansergheev
adriansergheev / AppDefault.swift
Created July 19, 2024 15:14 — forked from jasdev/AppDefault.swift
Swift nonmutating Example
import Foundation
enum AppDefault {
case APIServer, runMode, homeDirectory, reactHost
var stringValue: String? {
get {
return NSUserDefaults.standardUserDefaults().stringForKey(String(self))
}
@adriansergheev
adriansergheev / reverse-ssh-tunnel-vps-to-pi.md
Created May 21, 2024 08:57 — forked from rfairley/reverse-ssh-tunnel-vps-to-pi.md
Connecting to a Raspberry Pi through a VPS using a reverse SSH tunnel

Connecting to a Raspberry Pi through a VPS using a reverse SSH tunnel

SSH (Secure Shell) to a host existing in an internal network through a reverse-tunneled SSH connection to an externally accessible VPS (Virtual Private Server). This setup is described where the internal host is a Raspberry Pi, but can be generalized for any host on the internal network that runs an OpenSSH server.

  internal network                                                   Internet                                       home network
                                              ||                                                         ||
 ------------------                           ||                          ------------------             ||             ------------------
|                  | reverse SSH tunnel (VPS $tunnel_port to Pi port 22) |                  |            ||            |                  |
|   Raspberry Pi     ==================================================>         VPS          ===================
@adriansergheev
adriansergheev / Count lines of code in Xcode project
Created August 20, 2021 14:59 — forked from Tokuriku/Count lines of code in Xcode project
Count lines of code in SWIFT Xcode project
1. Open Terminal
2. cd to your Xcode project
3. Execute the following when inside your target project:
find . -name "*.swift" -print0 | xargs -0 wc -l
import PlaygroundSupport
import Foundation
import Combine
// MARK: - Network Controller
protocol NetworkControllerProtocol: class {
typealias Headers = [String: Any]
func get<T>(type: T.Type,
url: URL,
@adriansergheev
adriansergheev / Best in Class iOS Checklist
Created August 2, 2020 13:40 — forked from DreamingInBinary/Best in Class iOS Checklist
This is a public checklist updated every year after the latest version of iOS and iPadOS are shipped. It's a boiled down version of a "Best in Class" app checklist created by Jordan Morgan.
# A Best in Class Checklist
A boiled down checklist adapted from this [post](https://www.swiftjectivec.com/a-best-in-class-app/), created by @jordanmorgan10.
> To use this, create a Github Issue in your own repo, and simply copy and paste this text.
## iOS Core Technology
_Things any iOS app can benefit from_
- [ ] iCloud Sync
- [ ] [Core Spotlight integration](https://github.com/DreamingInBinary/Spend-Stack/issues/120)
@adriansergheev
adriansergheev / Tiny_reactive.swift
Created June 14, 2020 14:38 — forked from atimca/Tiny_reactive.swift
A tiny realization of a reactive approach.
import PlaygroundSupport
import Foundation
class WeakRef<T> where T: AnyObject {
private(set) weak var value: T?
init(value: T?) {
self.value = value
}
//
// ObservableEventTransforms.swift
//
// Created by Daniel Tartaglia on 9/22/18.
// Copyright © 2019 Daniel Tartaglia. MIT License.
//
import RxSwift
/**
@adriansergheev
adriansergheev / ios-cell-registration-swift.md
Created May 30, 2019 07:18 — forked from gonzalezreal/ios-cell-registration-swift.md
iOS Cell Registration & Reusing with Swift Protocol Extensions and Generics

iOS Cell Registration & Reusing with Swift Protocol Extensions and Generics

A common task when developing iOS apps is to register custom cell subclasses for both UITableView and UICollectionView. Well, that is if you don’t use Storyboards, of course.

Both UITableView and UICollectionView offer a similar API to register custom cell classes:

public func registerClass(cellClass: AnyClass?, forCellWithReuseIdentifier identifier: String)
public func registerNib(nib: UINib?, forCellWithReuseIdentifier identifier: String)