Skip to content

Instantly share code, notes, and snippets.

View ArtSabintsev's full-sized avatar
😎
Having fun!

Arthur Ariel Sabintsev ArtSabintsev

😎
Having fun!
View GitHub Profile
@ArtSabintsev
ArtSabintsev / bundle+module.swift
Created December 21, 2020 16:06
Example of Bundle.module
// Source: https://developer.apple.com/forums/thread/650158?answerId=614513022#614513022
import Foundation
extension Bundle {
static let module = Bundle(path: "\(Bundle.main.bundlePath)/path/to/this/targets/resource/bundle")
}
@ArtSabintsev
ArtSabintsev / bundle+extension.swift
Last active December 21, 2020 18:29
Bundle Extension for Swift PM and CocoaPods
private extension Bundle {
/// The path to Siren's localization `Bundle`.
///
/// - Returns: The bundle's path or `nil`.
final class func sirenBundlePath() -> String? {
#if SWIFT_PACKAGE
return Bundle.module.path(forResource: "\(Siren.self)", ofType: "bundle")
#else
return Bundle(for: Siren.self).path(forResource: "\(Siren.self)", ofType: "bundle")
#endif
@ArtSabintsev
ArtSabintsev / Xcode - Show Build Times
Created December 21, 2017 03:55
Xcode - Show Build Times
defaults write com.apple.dt.Xcode ShowBuildOperationDuration -bool YES
@ArtSabintsev
ArtSabintsev / buddybuild_postbuild.sh
Last active May 1, 2017 20:23
BuddyBuild Post Build Script
#!/usr/bin/env bash
BR=$( git describe --contains --all HEAD )
echo Branch: $BR
if [ $BR = master ]
then
git add Path/To/Supporting\ Files/Info.plist
git commit --allow-empty -m "[skip ci] finished build: $BUDDYBUILD_BUILD_NUMBER"
git push
@ArtSabintsev
ArtSabintsev / PortaitNavigationController.swift
Last active April 29, 2017 03:44
Portrait Mode Navigation Controller
/// Constrains child ViewController's to be in portrait mode when loaded within this specific Navigation Controller stack.
final class PortaitNavigationController: UINavigationController {
override func viewDidLoad() {
super.viewDidLoad()
// Hide Border
navigationBar.setBackgroundImage(UIImage(), for: .default)
navigationBar.shadowImage = UIImage()
}
@ArtSabintsev
ArtSabintsev / git_aliases.sh
Created April 20, 2017 20:22
Useful Git Aliases
alias ga='git add . && git status'
alias gb='git branch'
alias gbd='git branch -D'
alias gch='git checkout'
alias gcam='git commit -am'
alias gp='git push'
alias gpo='git push origin'
alias gs='git status'
alias gu='git pull --all && git fetch -p && git branch --merged | grep -v '^*' | grep -v master | grep -v develop | xargs -n 1 git branch -d && git branch -a'
alias gclean='git clean -fd && git reset && git checkout -f && git status'
@ArtSabintsev
ArtSabintsev / update_alias.sh
Created April 20, 2017 20:18
Update RVM, rubygems, and Homebrew
alias up='rvm get stable && rvm rubygems latest && gem update && brew update && brew upgrade && brew doctor && brew cleanup'
@ArtSabintsev
ArtSabintsev / UserDefaultsKeyExamples.swift
Created March 22, 2017 15:04
An example on a couple ways to create keys for UserDefaults.
import Foundation
enum EnumKey: String {
case aKey = "Key A from Enum"
case bKey = "Key B from Enum"
case cKey = "Key C from Enum"
}
struct StructKey {
static let aKey = "Key A from Struct"

Keybase proof

I hereby claim:

  • I am artsabintsev on github.
  • I am artsabintsev (https://keybase.io/artsabintsev) on keybase.
  • I have a public key ASB0hPuTXmwimUDXQ6GL551uQb_azvka7u7h_RxlBQ9oKwo

To claim this, I am signing this object:

@ArtSabintsev
ArtSabintsev / GenericOverload.swift
Last active October 27, 2016 04:12
Overloading Generic and Non-Generic Functions
import Foundation
typealias T = Int
struct S {
public static func f<T>(a: T, b: Int) {
print(a, b)
f(a: a, b: b) // Infinitely calls the f<t>{} method (e.g., creates infinite loop)
}