Skip to content

Instantly share code, notes, and snippets.

View alekseypotapov-dev's full-sized avatar

Aleksey Potapov alekseypotapov-dev

View GitHub Profile
@alekseypotapov-dev
alekseypotapov-dev / cleaning.txt
Last active May 22, 2024 09:42
Cleaning mac from Xcode's files
Clean the following folders referring to http://ajithrnayak.com/post/95441624221/xcode-users-can-free-up-space-on-your-mac
~/Library/Developer/Xcode/DerivedData
~/Library/Developer/Xcode/Archives
~/Library/Developer/Xcode/iOS DeviceSupport
~/Library/Developer/CoreSimulator
~/Library/Caches/com.apple.dt.Xcode
~/Library/Application Support/MobileSync/
xcrun simctl delete unavailable
@alekseypotapov-dev
alekseypotapov-dev / script.sh
Created May 4, 2018 10:27
Change spaces to underscore for all filenames in current folder
for f in *\ *; do mv "$f" "${f// /_}"; done
@alekseypotapov-dev
alekseypotapov-dev / .swiftlint.yml
Created March 1, 2018 14:56
Currently using this swiftlint
# SwiftLint configuration file
#
# Used for DEBUG builds.
#
# rule identifiers to exclude from running
disabled_rules:
- line_length # to be used
- function_body_length
- type_body_length
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>ANSIBlackColor</key>
<data>
YnBsaXN0MDDUAQIDBAUGFRZYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS
AAGGoKMHCA9VJG51bGzTCQoLDA0OVU5TUkdCXE5TQ29sb3JTcGFjZVYkY2xhc3NGMCAw
IDAAEAGAAtIQERITWiRjbGFzc25hbWVYJGNsYXNzZXNXTlNDb2xvcqISFFhOU09iamVj
dF8QD05TS2V5ZWRBcmNoaXZlctEXGFRyb290gAEIERojLTI3O0FITltiaWttcn2GjpGa
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>ANSIBlackColor</key>
<data>
YnBsaXN0MDDUAQIDBAUGFRZYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS
AAGGoKMHCA9VJG51bGzTCQoLDA0OVU5TUkdCXE5TQ29sb3JTcGFjZVYkY2xhc3NGMCAw
IDAAEAGAAtIQERITWiRjbGFzc25hbWVYJGNsYXNzZXNXTlNDb2xvcqISFFhOU09iamVj
dF8QD05TS2V5ZWRBcmNoaXZlctEXGFRyb290gAEIERojLTI3O0FITltiaWttcn2GjpGa
/// Wraps the observer token received from
/// NotificationCenter.addObserver(forName:object:queue:using:)
/// and unregisters it in deinit.
final class NotificationToken: NSObject {
let notificationCenter: NotificationCenter
let token: Any
init(notificationCenter: NotificationCenter = .default, token: Any) {
self.notificationCenter = notificationCenter
self.token = token
@alekseypotapov-dev
alekseypotapov-dev / CoreGraphicsExtension.swift
Last active September 29, 2016 16:56
CoreGraphics methods override
//Copyright
//https://habrahabr.ru/post/271647/
import Foundation
// Summ and Substraction of Vectors
func +(left: CGPoint, right: CGPoint)->CGPoint{
return CGPoint(x: left.x+right.x, y: left.y+right.y)
}
prefix func -(right: CGPoint)->CGPoint{
@alekseypotapov-dev
alekseypotapov-dev / my.zshrc
Created September 21, 2016 15:03
Configured regarding needs
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH=/Users/alex-potapov/.oh-my-zsh
# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
ZSH_THEME="robbyrussell"
@alekseypotapov-dev
alekseypotapov-dev / UniqueValues.swift
Created September 20, 2016 12:39
Unique Sequence
func uniq<S: SequenceType, E: Hashable where E==S.Generator.Element>(source: S) -> [E] {
var seen: [E:Bool] = [:]
return source.filter { seen.updateValue(true, forKey: $0) == nil }
}
@alekseypotapov-dev
alekseypotapov-dev / ArrayExtension.swift
Created September 20, 2016 10:31
Group Array of Arrays by parameter
extension Array {
func groupBy<G: Hashable>(groupClosure: (Element) -> G) -> [[Element]] {
var groups = [[Element]]()
for element in self {
let key = groupClosure(element)
var active = Int()
var isNewGroup = true
var array = [Element]()