Skip to content

Instantly share code, notes, and snippets.

View sc0rch's full-sized avatar

sc0rch

  • Moscow
View GitHub Profile
@drrost
drrost / RunSwiftlintOnlyForChangedFiles.sh
Created November 3, 2019 15:48
Runs Swiftlint only for changed files - Xcode run script
# Created by: Rostyslav Druzhchenko
#
# Get current time
#
START_DATE=$(date +"%s")
# Save Swiftlint full path to a local variable
#
SWIFT_LINT=/usr/local/bin/swiftlint
@ethanhuang13
ethanhuang13 / detect-string-language.swift
Created March 23, 2017 03:46
Detect string language with Swift
//: Playground - noun: a place where people can play
//
// The result is not guaranteed to be accurate. Typically, the function requires 200-400 characters to reliably guess the language of a string.
// Reference: [CFStringTokenizerCopyBestStringLanguage(_:_:)](https://developer.apple.com/reference/corefoundation/1542136-cfstringtokenizercopybeststringl)
//
import Foundation
extension String {
func guessLanguage() -> String {