Skip to content

Instantly share code, notes, and snippets.

View xxKRASHxx's full-sized avatar
🐺

Daniel Lisovoy xxKRASHxx

🐺
View GitHub Profile
@xxKRASHxx
xxKRASHxx / macos-reset-app-permission.md
Created April 17, 2024 10:37
Reset app permissions on MacOS
  1. Start terminal and then sudo to a root shell
    sudo -s

  2. Go to /var/db/locationd
    cd /var/db/locationd

  3. Make a backup of the clients.plist file
    cp -p clients.plist clients.plist.save

  4. Convert clients.plist to xml (editable format)

@xxKRASHxx
xxKRASHxx / example.ts
Created December 8, 2021 20:23
Union types in Typescript
import { } from 'firebase-admin'
import Hub from '../../../../../documents/hub'
import Item from '../../../../../documents/item'
type AnalyticsInput =
| UserAnalyticsInput
| HubAnalyticsInput
| ItemAnalyticsInput
enum AnalyticsInputType {
@xxKRASHxx
xxKRASHxx / michael_smolin.md
Last active July 30, 2021 09:19
Michael Smolin gift

Михаил, привет

Тебя очень хуёво слышно на митингах, а тебе плохо слышно свои мысли из-за ора вокруг ганг бистс...

Для ПМ это просто недопустимо.

Мы, твои коллеги, как никто другой понимаем всю ценность этого.

По-этому мы решили помочь тебе решить этот вопрос.

import UIKit
public protocol Reusable {
static var reuseIdentifier: String { get }
}
public extension Reusable {
static var reuseIdentifier: String {
return String(describing: self)
}
@xxKRASHxx
xxKRASHxx / SortDescriptor.swift
Created February 13, 2020 12:31 — forked from calda/SortDescriptor.swift
SortDescriptor.playground
import Foundation
// MARK: SortDescriptor
/// Type-erased Sort Descriptor (can store multiple in the same array
/// regardless of the underlying KeyPath
public struct SortDescriptor<Element> {
private let comparator: (Any, Any) -> Bool
version: 2
jobs:
build:
macos:
xcode: "10.2.1"
shell: /bin/bash --login -eo pipefail
working_directory: /Users/distiller/project
environment:

Sourcery - Meta-programming tool

Swift-icon

Sources

  • Sourcery - GitHub repo;
  • Lenses exapmle - How to supercharge Swift enum-based states with Sourcery, how to setup environment in a right way;
  • AnyAction - Codable protocol implementers.
import Foundation
<%
func camelCased(_ string: String) -> String {
return "\(String(string.first!).lowercased())\(String(string.dropFirst()))".replacingOccurrences(of: ".", with: "")
}
func allEvents() -> [Type] {
return types.all.filter { type in
(type is Struct || type is Enum) && (type.implements["AppEvent"] != nil)

MQTT - Starter pack

Redux-ReactiveSwift

Sources

  • CocoaMQTT - client library for iOS/macOS/tvOS written with Swift 4
  • MQTT Server - Setting up mosquitto (mqtt) and brew on mac os tutorial
  • MQTT fx - MQTT Client GUI
@xxKRASHxx
xxKRASHxx / Handle.swift
Last active December 12, 2018 11:04
Error handling
func handle(_ errors: [Error]) -> Action {
func invalidToken(error: Client.Error) -> Action? {
guard error.message == "INVALID_TOKEN" else { return nil }
return InvalidateToken()
}
func paymentRequired(error: Client.Error) -> Action? {
guard error.message == "PAYMENT_REQUIRED" else { return nil }