Skip to content

Instantly share code, notes, and snippets.

View vladimir-bebeshko's full-sized avatar

Vladimir Bebeshko vladimir-bebeshko

  • Zaporizhzhya, Ukraine
View GitHub Profile
@vladimir-bebeshko
vladimir-bebeshko / pre-commit-swiftlint.sh
Last active May 15, 2019 09:50 — forked from haruair/pre-commit-swiftlint.sh
Git Client-side pre-commit hook for SwiftLint
#!/bin/bash
#
# hook script for swiftlint. It will triggered when you make a commit.
#
#TODO: move this content to separate file ('lint'), add separate file for swiftformat ('format'), use them here in pre-commit
GUI=0
LINT_PATH_FOR_GUI="/usr/local/bin/swiftlint"
@vladimir-bebeshko
vladimir-bebeshko / Contents.swift
Last active December 1, 2018 17:21 — forked from morishin/1_playground.swift
Custom Shape View with Shadow
//: A UIKit based Playground for presenting user interface
import UIKit
import PlaygroundSupport
let container = UIView(frame: CGRect(x: 0, y: 0, width: 500, height: 200))
container.backgroundColor = .lightGray
class MyView: UIView {
@vladimir-bebeshko
vladimir-bebeshko / UIFont+BestFit.swift
Created December 8, 2018 12:02 — forked from joncardasis/UIFont+BestFit.swift
Swift Dynamic Font Size for Bounds
extension UIFont {
/**
Will return the best font conforming to the descriptor which will fit in the provided bounds.
*/
static func bestFittingFontSize(for text: String, in bounds: CGRect, fontDescriptor: UIFontDescriptor, additionalAttributes: [NSAttributedStringKey: Any]? = nil) -> CGFloat {
let constrainingDimension = min(bounds.width, bounds.height)
let properBounds = CGRect(origin: .zero, size: bounds.size)
var attributes = additionalAttributes ?? [:]
// Public domain - https://gist.github.com/nolanw/dff7cc5d5570b030d6ba385698348b7c
import Foundation
extension URLRequest {
/**
Configures the URL request for `multipart/form-data`. The request's `httpBody` is set, and a value is set for the HTTP header field `Content-Type`.
- Parameter parameters: The form data to set.
import SwiftUI
import WidgetKit
struct WaterAppTimelineProvider: TimelineProvider {
func placeholder(in context: Self.Context) -> WaterAppWidgetEntry {
return .previewData
}
func getSnapshot(in context: Self.Context, completion: @escaping (WaterAppWidgetEntry) -> Void) {
@vladimir-bebeshko
vladimir-bebeshko / NumberPadDoneBtn.h
Created December 31, 2020 14:29 — forked from matt-curtis/NumberPadDoneBtn.h
Done Button for UIKeyboard NumberPad (must be set as inputAccessoryView)
#import <UIKit/UIKit.h>
@interface NumberPadDoneBtn : UIView
@end
@interface NumberPadButton : UIButton
@end
@vladimir-bebeshko
vladimir-bebeshko / Appending.swift
Created January 18, 2021 12:59 — forked from noahsark769/Appending.swift
Nested property wrappers with Swift
// https://noahgilmore.com/blog/nesting-property-wrappers
import Cocoa
protocol Appendable {
func appending(string: String) -> Self
}
extension String: Appendable {
func appending(string: String) -> String {
@vladimir-bebeshko
vladimir-bebeshko / SwiftInST3.md
Created February 11, 2021 16:33 — forked from Star-Lord-XIII/SwiftInST3.md
Running Swift scripts from Sublime Text 3 in MacOSX10.11

##Adding Swift Build System

  • Open Sublime Text 3
  • Go To Preferences > Browse Packages...
  • Add a file named Swift.sublime-build inside Packages directory.
  • Copy the following script in Swift.sublime-build file.
{
 	"shell_cmd": "xcrun swift $file",
@vladimir-bebeshko
vladimir-bebeshko / iterm2_switch_automatic.md
Created November 9, 2021 08:35 — forked from FradSer/iterm2_switch_automatic.md
Switch iTerm2 color preset automatic base on macOS dark mode.

The latest beta (3.5) includes separate color settings for light & dark mode. Toggling dark mode automatically switches colors.

Vist iTerm 2 homepage to download the beta. Thanks @stefanwascoding.


  1. Add switch_automatic.py to ~/Library/ApplicationSupport/iTerm2/Scripts/AutoLaunch with:
@vladimir-bebeshko
vladimir-bebeshko / .vimrc
Last active December 27, 2024 13:17 — forked from simonista/.vimrc
A basic .vimrc file that will serve as a good template on which to build.
" Don't try to be vi compatible
set nocompatible
" Helps force plugins to load correctly when it is turned back on below
filetype off
" vim-plug: Vim plugin manager
" ============================
" Download plug.vim and put it in ~/.vim/autoload
"curl -fLo ~/.vim/autoload/plug.vim --create-dirs \