Skip to content

Instantly share code, notes, and snippets.

View MihaelIsaev's full-sized avatar
🎸
working on Swift for Web

Mikhail Isaev aka iMike MihaelIsaev

🎸
working on Swift for Web
View GitHub Profile

What's new in Swift 6 (Swiftify article translated into Russian)

Что нового в Swift 6 (перевод статьи Swiftify)

Apple планирует выпустить Swift 6 в сентябре 2024 года наряду с Xcode 16. Это будет первое крупное обновление Swift за последние пять лет, начиная с Swift 5. Этот выпуск приурочен к 10-летнему юбилею Swift. За эти годы Swift значительно развился, от простого улучшения Objective-C до безопасного, многофункционального и производительного языка, который легко использовать.

Apple ранее упоминала, что будут последовательно выпускаться версии Swift 5.x, вводящие инкрементальные изменения и новые функции для подготовки к Swift 6. Основные цели включали улучшение поддержки параллелизма и модели владения памятью. На данный момент они были достигнуты в значительной степени.

Давайте кратко вспомним эволюцию версий Swift

@MihaelIsaev
MihaelIsaev / AwesomeWSPing.swift
Created July 4, 2022 21:23
AwesomeWS automatic ping implementation
class YourCustomWS: ClassicObserver, LifecycleHandler {
var pingTask: RepeatedTask?
var waitForPongAttempts: [WaiterForPongAttempt] = []
public required init (app: Application, key: String, path: String, exchangeMode: ExchangeMode) {
super.init(app: app, key: key, path: path, exchangeMode: exchangeMode)
pingTask = app.eventLoop.scheduleRepeatedTask(initialDelay: .seconds(5), delay: .seconds(5)) { [weak self] task in
guard let self = self else { return }
self.waitForPongAttempts.enumerated().forEach { i, object in
if object.attempt >= 2 {
@MihaelIsaev
MihaelIsaev / proxy.pac
Created March 26, 2021 11:35 — forked from swinton/proxy.pac
Example proxy.pac, using a SOCKS proxy for certain hosts.
function FindProxyForURL(url, host) {
var useSocks = ["imgur.com"];
for (var i= 0; i < useSocks.length; i++) {
if (shExpMatch(host, useSocks[i])) {
return "SOCKS localhost:9999";
}
}
return "DIRECT";
function getCache(name) {
return new Promise((resolve, reject) => {
const version = 1;
const request = indexedDB.open(name, version);
request.onsuccess = event => {
const db = event.target.result;
/*
* Returns a Promise that resolves with an object
@MihaelIsaev
MihaelIsaev / ARMDebianUbuntu.md
Created September 5, 2020 01:32 — forked from Liryna/ARMDebianUbuntu.md
Emulating ARM on Debian/Ubuntu

You might want to read this to get an introduction to armel vs armhf.

If the below is too much, you can try Ubuntu-ARMv7-Qemu but note it contains non-free blobs.

Running ARM programs under linux (without starting QEMU VM!)

First, cross-compile user programs with GCC-ARM toolchain. Then install qemu-arm-static so that you can run ARM executables directly on linux

@MihaelIsaev
MihaelIsaev / UIKitPlus-TabBarImplementation.swift
Created June 26, 2020 11:13
Custom TabBar implementation for UIKitPlus. Not beautiful cause not wrapped, just sources. But it works well.
import UIKitPlus
class MainViewController: ViewController {
override var statusBarStyle: StatusBarStyle {
if let controller = controllers[current]?.protocolController {
if let controller = controller as? ViewController {
return controller.statusBarStyle
}
return .from(controller.preferredStatusBarStyle)
}
//
// Reflectable
//
// Copied from https://github.com/vapor/core
//
import Foundation
import NIO
struct CoreError: Error {
import Vapor
public protocol FutureParameter {
associatedtype ResolvedParameter
static var routingSlug: String { get }
static var parameter: PathComponent { get }
static func resolveParameter(_ parameter: String, on app: Application) -> EventLoopFuture<ResolvedParameter>
}
@MihaelIsaev
MihaelIsaev / gist:4015acb7d9e3a937f4ad4c420c50d24f
Created February 2, 2020 23:22 — forked from v-thomp4/gist:951b333a37ee2adb0d3ac557bd75aba4
nginx universal links apple-app-site-association
location = /apple-app-site-association {
proxy_pass http://static.example.com/apple-app-site-association;
proxy_hide_header Content-Type;
add_header Content-Type "application/json";
}
or
location = apple-app-site-association {
default_type application/json;
@MihaelIsaev
MihaelIsaev / multiple_ssh_setting.md
Created January 21, 2020 21:14 — forked from jexchan/multiple_ssh_setting.md
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"