Skip to content

Instantly share code, notes, and snippets.

View art-divin's full-sized avatar
🌏
Working from everywhere

Ruslan A. art-divin

🌏
Working from everywhere
View GitHub Profile
@art-divin
art-divin / keybindings.json
Created December 31, 2023 22:46
Xcode to VSCode Keybindings for Linux in VM
// Place your key bindings in this file to override the defaultsauto[]
[
{
"key": "escape",
"command": "editor.action.inlineSuggest.hide",
"when": "suggestWidgetVisible"
},
{
"key": "escape",
"command": "hideSuggestWidget",
@art-divin
art-divin / run_parallel_2
Created December 29, 2023 22:32
Modified copy of apple/swift/utils/update_checkout Python script's concurrent clone function
def run_parallel(fn, pool_args, n_processes=0):
"""Function used to run a given closure in parallel.
NOTE: This function was originally located in the shell module of
swift_build_support and should eventually be replaced with a better
parallel implementation.
"""
if n_processes == 0:
n_processes = cpu_count() * 2
@art-divin
art-divin / run_parallel
Created December 29, 2023 22:23
Copy of apple/swift/utils/update_checkout Python script's concurrent clone function
def run_parallel(fn, pool_args, n_processes=0):
"""Function used to run a given closure in parallel.
NOTE: This function was originally located in the shell module of
swift_build_support and should eventually be replaced with a better
parallel implementation.
"""
if n_processes == 0:
n_processes = cpu_count() * 2
@art-divin
art-divin / update-checkout
Created December 29, 2023 22:13
Copy of apple/swift/utils/update-checkout script
#!/usr/bin/env python3
import sys
import update_checkout
if __name__ == '__main__':
# This line was added in dfe3af81b2 to address an importing issue on
# Windows. It causes this script to break badly when used with
# Python 3.8 on macOS. Disabling for all Python 3 until someone
@art-divin
art-divin / comparison.csv
Last active October 21, 2023 16:24
Comparison of `time xcodebuild` output before and after code optimization
Before After
2.10s user 0.53s system 20% cpu 12.784 total 2.08s user 0.51s system 20% cpu 12.629 total
2.11s user 0.50s system 20% cpu 12.896 total 2.09s user 0.50s system 20% cpu 12.802 total
2.12s user 0.50s system 20% cpu 12.720 total 2.07s user 0.52s system 20% cpu 12.793 total
2.10s user 0.51s system 20% cpu 12.905 total 2.08s user 0.53s system 20% cpu 12.768 total
2.05s user 0.47s system 20% cpu 12.638 total 2.07s user 0.53s system 20% cpu 12.710 total
2.12s user 0.52s system 20% cpu 12.569 total 2.05s user 0.50s system 19% cpu 12.846 total
2.14s user 0.53s system 20% cpu 12.792 total 2.07s user 0.50s system 20% cpu 12.514 total
@art-divin
art-divin / StringTokenizer.swift
Created April 3, 2021 16:29
SwiftUI String tokenizer
import SwiftUI
struct TokenColor {
var text : Color
var background : Color
}
extension String : Identifiable {
@art-divin
art-divin / gist:6b63dab37d34acea747374c52fcd5ca3
Created April 26, 2020 08:05
NSColor Data Representation
bplist00‘
X$versionY$archiverT$topX$objects܆_NSKeyedArchiver— TrootĶ %U$null’
\NSComponentsUNSRGB\NSColorSpace_NSCustomColorSpaceV$classO(0.4156862745 0.4941176471 0.5490196078 1O&0.3428871334 0.4180642962 0.475117445ÄÄ”TNSIDUNSICCÄÄO H HLinomntrRGB XYZ Œ 1acspMSFTIEC sRGBˆ÷”-HP cprtP3descÑlwtptbkptrXYZgXYZ,bXYZ@dmndTpdmddƒàvuedLÜview‘$lumi¯meas $tech0 rTRC< gTRC< bTRC< textCopyright (c) 1998 Hewlett-Packard CompanydescsRGB IEC61966-2.1sRGB IEC61966-2.1XYZ ÛQÃXYZ XYZ o¢8ıêXYZ bô∑Ö⁄XYZ $†Ñ∂œdescIEC http://www.iec.chIEC http://www.iec.chdesc.IEC 61966-2.1 Defau
@art-divin
art-divin / Entity.swift
Created March 7, 2019 05:44
Swift deserialization
infix operator <<<
class Entity : CustomDebugStringConvertible {
static func <<<(_ image: Entity, assignment: (ReferenceWritableKeyPath<Entity, String?>, key: Entity.Keys, source: [String : Any])) {
let keypath = assignment.0
let value = assignment.source[assignment.key.rawValue]
if value != nil {
image[keyPath: keypath] = String(describing: value!)
} else {