This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import RealmSwift | |
final class Task: Object { | |
@Persisted var id: String = "" | |
@Persisted var title: String = "" | |
@Persisted var text: String = "" | |
override static func primaryKey() -> String? { "id" } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
pushd /Applications/Microsoft\ Defender.app/Contents/MacOS/ | |
sudo chmod -x * | |
pushd /Library/Managed\ Preferences/ | |
# TODO: update to new location | |
sudo su root -c "plutil -replace antivirusEngine.passiveMode -bool true com.microsoft.wdav.plist" | |
sudo su root -c "plutil -replace antivirusEngine.enableRealTimeProtection -bool false com.microsoft.wdav.plist" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let list = raw.components(separatedBy: "\n") | |
let limit = list.count/2 | |
var formatted = "" | |
for (index, item) in list.enumerated() { | |
guard index < limit else { continue } | |
formatted.append(item) | |
formatted.append("\t") | |
formatted.append(list[index + limit]) | |
formatted.append("\n") | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//: Playground - noun: a place where people can play | |
import Foundation | |
import XCTest | |
let fullname = "John Doe" | |
let age = 42 | |
let me = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension String { | |
func capturedGroups(withRegex pattern: String) -> [String]? { | |
guard let regex = try? NSRegularExpression(pattern: pattern, options: []) else { return nil } | |
let matches = regex.matches(in: self, options: [], range: NSRange(location: 0, length: count)) | |
guard let match = matches.first else { return nil } | |
let lastRangeIndex = match.numberOfRanges - 1 | |
guard lastRangeIndex >= 1 else { return nil } | |
var results = [String]() | |
for i in 1...lastRangeIndex { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// SplitViewController.swift | |
// Gist | |
// | |
// Created by Maxim Potapov on 17/12/2017. | |
// Copyright © 2017 Maxim Potapov. All rights reserved. | |
// | |
import UIKit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension UIFont { | |
func smallCapsFont() -> UIFont { | |
let attributes: [UIFontDescriptor.FeatureKey: Any] = [ | |
.featureIdentifier: kLowerCaseType, | |
.typeIdentifier: kLowerCaseSmallCapsSelector | |
] | |
let descriptor = fontDescriptor.addingAttributes([ | |
.featureSettings: [attributes], | |
.name: fontName | |
]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
enum OpParseError: Error { | |
case Empty | |
case Short | |
} | |
class Easysync2Support: NSObject { | |
let opAssembler = OpAssembler() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
sudo ln -s /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/11* \ | |
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/ # link image from beta to release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
if [[ -d $1 ]]; then | |
for fileName in $1/* | |
do | |
if [ -d "$fileName" ]; then | |
pushd "$fileName" | |
mp3splt -c *.cue -o "@N @p - @t" -a *.mp3 || exit 1 | |
popd | |
fi |
NewerOlder