Skip to content

Instantly share code, notes, and snippets.

View PaulTaykalo's full-sized avatar

Paul Taykalo PaulTaykalo

View GitHub Profile
@PaulTaykalo
PaulTaykalo / .zshrc
Created November 6, 2023 22:46
Re-request all Revieers Again
function re_request_reviews {
# Get the details of latest reviews
local latest_reviews=$(gh pr view --json latestReviews -q '.latestReviews[] | select(.state != "APPROVED") | .author.login')
# Create an empty string variable to aggregate the reviewer list
local reviewers=""
# Loop through the list of reviewers who haven't approved and add each one to the reviewer list
for reviewer in $latest_reviews; do
Happy April 1st
@PaulTaykalo
PaulTaykalo / AppKit.pcm
Created March 18, 2023 22:10
-module-file-info output for AppKit
Information for module file 'ProjectDir/.build/DerivedData/ModuleCache.noindex/1UER563BX8AHK/AppKit-1LWHB1MWS5AWP.pcm':
Module format: raw
Generated by this Clang: (clang-1400.0.29.202)
Module name: AppKit
Module map file: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/System/Library/Frameworks/AppKit.framework/Modules/module.modulemap
Imports module 'Foundation': ProjectDir/.build/DerivedData/ModuleCache.noindex/1UER563BX8AHK/Foundation-2FJBXN8U6QRTS.pcm
Imports module 'CoreFoundation': ProjectDir/.build/DerivedData/ModuleCache.noindex/1UER563BX8AHK/CoreFoundation-RZX25862PY17.pcm
Imports module 'Darwin': ProjectDir/.build/DerivedData/ModuleCache.noindex/1UER563BX8AHK/Darwin-1IVCWVLR6MT9T.pcm
Imports module 'CoreGraphics': ProjectDir/.build/DerivedData/ModuleCache.noindex/1UER563BX8AHK/CoreGraphics-MC4FPA2MN9QR.pcm
Imports module 'IOKit': ProjectDir/.build/DerivedData/ModuleCache.noindex/1UER563BX8AHK/IOKit-PMP3SCKMT7TH.pcm
const removeEmptyValues = val => {
const isInvalid = value => value === null || value === '' || value === false;
if (isInvalid(val)) return;
if (Array.isArray(val)) {
return val.map(removeEmptyValues).filter(val => val !== undefined);
} else if (typeof val === 'object') {
const entries = Object.entries(val).filter(([, value]) => !isInvalid(value));
return Object.fromEntries(entries.map(([key, value]) => [key, removeEmptyValues(value)]));
}
return val;
protocol P {
func hello()
}
// Non generic class
class A {
// poroperty of type P
var prop: P
@PaulTaykalo
PaulTaykalo / autclosure.swift
Last active March 22, 2022 17:44
Strange generic? autoclosure?
struct Err: Error {}
open class ClosureContainer<Closure, Value> {
var arg: Closure?
}
func unwrap<T>(_ expression: @autoclosure () throws -> T?) throws -> T {
guard let value = try expression() else { throw Err() }
return value
}
// Debugging Builds
defaults write com.apple.dt.XCBuild EnableBuildDebugging -bool NO
// DEbugging Prebuilds
defaults write com.apple.dt.Xcode IDEShowPrebuildLogs YES
// DEbugging Indexing
defaults write com.apple.dt.Xcode IDEIndexShowLog -bool YES
@PaulTaykalo
PaulTaykalo / allprivatemocks.swiftlint.yml
Last active July 24, 2019 10:48
All Classes and Extensions declared in tests should be private of fileprivate
custom_rules:
all_private_helpers_in_tests:
included: ".*Tests?\\.swift"
name: "All private mocks"
regex: "^(class|extension) (?!\\w+Tests?)"
message: "All helpers in tests should be private"
severity: warning
@PaulTaykalo
PaulTaykalo / zshrc
Created June 13, 2019 05:16
Hub Pull Requests aliases
# Creates pull request on develop branch with specified message (second line is desciption)
function hubd {
hub pull-request -b develop -m $1
}
# Creates pull request on master branch with specified message (second line is desciption)
function hubm {
hub pull-request -b master -m $1
}
@PaulTaykalo
PaulTaykalo / MinMax.swift
Created September 20, 2018 14:27
MinMax.swift
extension Sequence {
@warn_unqualified_access
public func min<T:Comparable>(by: (Element) throws -> T) rethrows -> Element? {
return try self.min { try by($0) < by($1) }
}
@warn_unqualified_access
public func max<T:Comparable>(by: (Element) throws -> T) rethrows -> Element? {
return try self.max { try by($0) > by($1) }
}
}