Skip to content

Instantly share code, notes, and snippets.

View a-voronov's full-sized avatar
👽
Curious

Oleksandr Voronov a-voronov

👽
Curious
View GitHub Profile
@a-voronov
a-voronov / .fileMergeFix
Last active April 15, 2024 10:15
Fixing Xcode FileMerge spamming in terminal when merging swift files
cp /Applications/Xcode.app/Contents/SharedFrameworks/SourceModel.framework/Versions/A/Resources/LanguageSpecifications/Swift.xclangspec /Applications/Xcode.app/Contents/SharedFrameworks/DVTFoundation.framework/Versions/A/Resources/Swift.xclangspec
@a-voronov
a-voronov / .remap
Created February 7, 2024 11:00
remap Finnish keyboard to US layout
sudo hidutil property --set '{ "UserKeyMapping": [ { "HIDKeyboardModifierMappingSrc": 0x700000064, "HIDKeyboardModifierMappingDst": 0x700000035 }, { "HIDKeyboardModifierMappingSrc": 0x700000035, "HIDKeyboardModifierMappingDst": 0x7000000E1 } ] }'
@a-voronov
a-voronov / Monokai.xccolortheme
Last active October 27, 2023 06:16
Xcode 11 Monokai Theme 🎨
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>DVTConsoleDebuggerInputTextColor</key>
<string>1 1 1 1</string>
<key>DVTConsoleDebuggerInputTextFont</key>
<string>SFMono-Medium - 12.0</string>
<key>DVTConsoleDebuggerOutputTextColor</key>
<string>1 1 1 1</string>
@a-voronov
a-voronov / async-tasks-serial-queue.swift
Last active March 10, 2022 10:43
Async Task + Serial Queue based on ReactiveSwift ✨
import ReactiveSwift
import Result
// MARK: - Task
final class Task<V, E: Error> {
typealias ProcessingHandler = (@escaping (Result<V, E>) -> Void, DisposableBag) -> Void
enum State {
case idle
@a-voronov
a-voronov / GeoHash.swift
Last active September 15, 2021 16:58
proximity-hash
import CoreLocation
/// Geohash algorithm implementation.
///
/// It is a hierarchical spatial data structure which subdivides space into buckets of grid shape,
/// which is one of the many applications of what is known as a Z-order curve, and generally space-filling curves.
///
/// Geohashes offer properties like arbitrary precision
/// and the possibility of gradually removing characters from the end of the code to reduce its size (and gradually lose precision).
/// Geohashing guarantees that the longer a shared prefix between two geohashes is, the spatially closer they are together.
@a-voronov
a-voronov / requirements-x86_64.txt
Last active August 27, 2021 22:14
OpenCV Courses - Jupyter + Python + dlib on Big Sur M1 x86_64
appnope==0.1.2
argon2-cffi==20.1.0
attrs==21.2.0
backcall==0.2.0
bleach==4.0.0
cffi==1.14.6
cycler==0.10.0
debugpy==1.4.1
decorator==5.0.9
defusedxml==0.7.1
@a-voronov
a-voronov / requirements-arm64.txt
Last active August 22, 2021 02:33
OpenCV Courses - Jupyter + Python on Big Sur M1 arm64
appnope==0.1.2
argon2-cffi==20.1.0
attrs==21.2.0
backcall==0.2.0
bleach==4.0.0
certifi==2021.5.30
cffi==1.14.6
cycler==0.10.0
debugpy==1.4.1
decorator==4.4.2
@a-voronov
a-voronov / Maybe.swift
Created September 5, 2020 23:44
Optional built with Struct 🤪
/// Example of using static functions and properties to construct an instance of a type
/// for a struct, similar to how enum uses its cases.
/// Let's call it Maybe.
struct Maybe<Wrapped> {
private(set) var value: Wrapped!
var hasValue: Bool {
value != nil
}
@a-voronov
a-voronov / AnyLoadingStatus.swift
Last active August 31, 2020 11:08
Loading Status FSM 🚥
/// Represents loading status, consisting of multiple steps.
/// All values' types can be specified depending on the problem.
enum AnyLoadingStatus<Loading, Loaded, Failed, Error: Swift.Error> {
case idle
case loading(Loading)
case loaded(Loaded)
case failed(Failed, Error)
}
extension AnyLoadingStatus {
@a-voronov
a-voronov / mr-reminder.rb
Last active May 14, 2020 13:09
Gitlab Merge Requests Reminder
require 'getoptlong'
require 'gitlab'
opts = GetoptLong.new(
['--help', '-h', GetoptLong::NO_ARGUMENT],
['--endpoint', '-e', GetoptLong::REQUIRED_ARGUMENT],
['--token', '-t', GetoptLong::REQUIRED_ARGUMENT],
['--group', '-g', GetoptLong::REQUIRED_ARGUMENT],
['--webhook', '-w', GetoptLong::REQUIRED_ARGUMENT]
)