Skip to content

Instantly share code, notes, and snippets.

View timbaev's full-sized avatar
💭
📱

Timur Shafigullin timbaev

💭
📱
View GitHub Profile
//
// HostingCell.swift
// theathletic-ios
//
// Created by .
// Copyright © 2021 The Athletic. All rights reserved.
//
import SwiftUI
import UIKit
@mackoj
mackoj / Font+Autoregistering.swift
Last active December 28, 2023 07:11
This simplifies the process of loading custom fonts that are resources in an iOS Apple SPM Package (Swift Package Manager).
import Foundation
import UIKit
public typealias FontNameExt = (name: String, ext: String)
public func autoRegisteringFont(_ fontNames: [FontNameExt], _ spmBundleName : String) throws {
guard let spmBundle = Bundle(bundleName: spmBundleName) else {
throw("Fail to find bundle(\(spmBundleName).bundle) in your app bundle.")
}
try fontURLs(for: fontNames, in: spmBundle).forEach { try registerFont(from: $0) }
extension UIHostingController {
convenience public init(rootView: Content, ignoreSafeArea: Bool) {
self.init(rootView: rootView)
if ignoreSafeArea {
disableSafeArea()
}
}
func disableSafeArea() {
@tringn
tringn / README.md
Last active November 29, 2023 16:00
Install OhMyZsh with agnoster theme in MacOS Catalina Terminal

Step 1: Install Zsh (this may not be necessary because Zsh has been installed in MacOs Catalina)

brew install zsh

Step 2: Install OhMyZsh

sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

Step 3: Change shell in Mac Terminal from Bash to Zsh

chsh -s /bin/zsh

Step 4: Open ~/.zshrc, change ZSH_THEME from "robbyrussell" to "agnoster"

@EfraimB
EfraimB / PromiseKitCancellablePromise.swift
Created November 22, 2018 11:49
PromiseKit (6.4.1) CancellablePromise
//
// Promise + CancelRequest.swift
// PeopleFinders
//
// Created by Efraim Budusan on 12/13/17.
// Copyright © 2017 Tapptitude. All rights reserved.
//
import Foundation
import PromiseKit
@fnky
fnky / ANSI.md
Last active May 4, 2024 22:07
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@zmts
zmts / tokens.md
Last active May 4, 2024 17:22
Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Last major update: 25.08.2020

  • Что такое авторизация/аутентификация
  • Где хранить токены
  • Как ставить куки ?
  • Процесс логина
  • Процесс рефреш токенов
  • Кража токенов/Механизм контроля токенов
@NicholasTD07
NicholasTD07 / how-to-download-iOS-simulator-in-command-line-and-install-it.md
Last active November 10, 2023 19:39
How to Download iOS Simulator (Xcode) in Command Line and Install it

How to Download iOS Simulator (Xcode) in Command Line and Install it

For faster connection speed and more flexibility.

Steps

  1. Start Xcode in command line by running this in commandline /Applications/Xcode.app/Contents/MacOS/Xcode
  2. Start downloading of the simulator
  3. Cancel it. YES CANCEL IT!
  4. You will get a message like this: