Skip to content

Instantly share code, notes, and snippets.

View libdx's full-sized avatar

Alexander Ignatenko libdx

View GitHub Profile
" WSL yank support
let s:clip = '/mnt/c/Windows/System32/clip.exe' " change this path according to your mount point
if executable(s:clip)
augroup WSLYank
autocmd!
autocmd TextYankPost * if v:event.operator ==# 'y' | call system(s:clip, @0) | endif
augroup END
endif
Get-WinUserLanguageList
$1=New-WinUserLanguageList en-US
Set-WinUserLanguageList $1
MAX = 50
def solve(val: int, op: str) -> int:
if op == '+':
a = random.randint(0, val)
return val - a, a
elif op == '-':
a = random.randint(0, MAX - val)
return val + a, a
else:
enum NavStyle {
case push
case modal
case back
}
struct Nav {
let navs: [Nav]
let style: NavStyle = .push
#!/usr/bin/env python3
from math import *
import sys
if __name__ == '__main__':
script = ' '.join(sys.argv[1:]).strip()
if len(script) > 0:
print(script, '=', end='')
result = eval(script)
protocol Identifiable {
var id: String { get }
}
struct Settings: Codable, Identifiable {
var id: String = "44"
var name: String = "test"
}
extension Settings: UserDefaultsStoring {}
#!/usr/bin/env bash
(
NOTES_REPO=~/.notes
FILE_PATH=$1
DIR_PATH=$(dirname $FILE_PATH)
cd $NOTES_REPO
if [ ! -d $DIR_PATH ]; then
mkdir -p $(dirname $DIR_PATH)
fi
// Abstract interface
protocol Interactor: class {
associatedtype Action
func dispatch(action: Action)
init()
}
protocol Presenter: class {
associatedtype State
interface Transformer<A, B> {
B.Element transform(A.Element a);
}
//: Playground - noun: a place where people can play
import UIKit
protocol AnyValidator {
func validate(any: Any) -> Bool
}
protocol Validator: AnyValidator {
associatedtype Value