Skip to content

Instantly share code, notes, and snippets.

View jayesh15111988's full-sized avatar

Jayesh Kawli jayesh15111988

View GitHub Profile
@stinger
stinger / CombineFetcher.swift
Last active January 28, 2023 18:07
Combine - fetching data using URLSession publishers
import Foundation
import Combine
enum APIError: Error, LocalizedError {
case unknown, apiError(reason: String)
var errorDescription: String? {
switch self {
case .unknown:
return "Unknown error"
@kayoslab
kayoslab / swiftlint.yml
Created July 8, 2020 05:54
Default configuration for SwiftLint. This is the standard configuration I use in most of my projects.
### Global configuration
# Enable rules which are not in the default set
opt_in_rules:
# - anyobject_protocol # Prefer using `AnyObject` over `class` for class-only protocols.
# - array_init # Prefer using `Array(seq)` over `seq.map { $0 }` to convert a sequence into an Array.
# - attributes # Attributes should be on their own lines in functions and types, but on the same line as variables and imports.
- block_based_kvo # Prefer the new block based KVO API with keypaths when using Swift 3.2 or later.
- class_delegate_protocol # Delegate protocols should be class-only so they can be weakly referenced.
- closing_brace # Closing brace with closing parenthesis should not have any whitespaces in the middle.
@zirkler
zirkler / gist:d83f24aeffb332a47dc8372c90026e26
Last active April 19, 2023 13:27
stackview_scrollview
import UIKit
import PlaygroundSupport
class MyViewController : UIViewController {
// 1.
lazy var stackView: UIStackView = {
let stackView = UIStackView()
stackView.axis = .horizontal
stackView.spacing = 20
@jayesh15111988
jayesh15111988 / .zshrc
Last active February 15, 2023 15:32
My zshrc file
function parse_git_branch() {
git branch 2> /dev/null | sed -n -e 's/^\* \(.*\)/[\1]/p'
}
COLOR_DEF=$'\e[0m'
COLOR_USR=$'\e[38;5;243m'
COLOR_DIR=$'\e[38;5;197m'
COLOR_GIT=$'\e[38;5;39m'
setopt PROMPT_SUBST