Skip to content

Instantly share code, notes, and snippets.

View timqzm's full-sized avatar
👨‍💻
Happy coding

Tim Kuzmin timqzm

👨‍💻
Happy coding
View GitHub Profile
@Omar-Ikram
Omar-Ikram / EndpointSecurityDemo.m
Last active May 30, 2024 23:57
A demo of using Apple's EndpointSecurity framework - tested on macOS Monterey 12.2.1 (21D62)
//
// main.m
// EndpointSecurityDemo
//
// Created by Omar Ikram on 17/06/2019 - macOS Catalina 10.15 Beta 1 (19A471t)
// Updated by Omar Ikram on 15/08/2019 - macOS Catalina 10.15 Beta 5 (19A526h)
// Updated by Omar Ikram on 01/12/2019 - macOS Catalina 10.15 (19A583)
// Updated by Omar Ikram on 31/01/2021 - macOS Big Sur 11.1 (20C69)
// Updated by Omar Ikram on 07/05/2021 - macOS Big Sur 11.3.1 (20E241)
// Updated by Omar Ikram on 04/07/2021 - macOS Monterey 12 Beta 2 (21A5268h)
@zthxxx
zthxxx / Activate Office 2019 for macOS VoL.md
Last active June 22, 2024 05:17
crack activate Office on mac with license file
@hooman
hooman / WeakReference.swift
Last active December 29, 2022 09:06
A set of utilities for working with weak references.
//: Playground - noun: a place where people can play
/// A protocol to provide an abstraction of types that hold a weak reference to a target object.
///
/// It is defined because a single generic implementation cannot support existentials, as they
/// do not conform to themselves or `AnyObject`. Most of its API is defined by protocol extensions
/// to makes it easier to create existential wrapper `struct`s or `final class`es.
///
/// Here is an example protocol and the corresponding weak reference
@matteodanelli
matteodanelli / ImagePicker.swit
Last active October 21, 2020 17:47
Create iOS alert controller for image and video selection, from camera or filesystem
class ImagePicker: UIViewController, UINavigationControllerDelegate {
@IBOutlet var pictureView: UIImageView!
func tapAddPicture(_ sender: Any) {
let imagePickerController = UIImagePickerController()
imagePickerController.delegate = self
imagePickerController.mediaTypes = ["public.image", "public.movie"]
let actionSheet = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
actionSheet.addAction(UIAlertAction(title: "Take Photo", style: .default, handler: { (action:UIAlertAction) in
@cprovatas
cprovatas / BlockBasedSelector.h
Last active June 9, 2024 13:08
Block-Based Selectors in Swift
//
// BlockBasedSelector.h
//
// Created by Charlton Provatas on 11/2/17.
// Copyright © 2017 CharltonProvatas. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface BlockBasedSelector : NSObject
@krodak
krodak / Realm+CascadeDeleting.swift
Last active April 27, 2023 19:16
Cascade deletion for RealmSwift
import RealmSwift
import Realm
protocol CascadeDeleting: class {
func delete<Entity>(_ list: List<Entity>, cascading: Bool)
func delete<Entity>(_ results: Results<Entity>, cascading: Bool)
func delete<Entity: Object>(_ entity: Entity, cascading: Bool)
}
@mbuchetics
mbuchetics / json.swift
Created June 30, 2017 09:28 — forked from reckenrode/json.swift
Decoding arbitrary JSON with the new Decoder in Swift 4
enum JSON: Decodable {
case bool(Bool)
case double(Double)
case string(String)
indirect case array([JSON])
indirect case dictionary([String: JSON])
init(from decoder: Decoder) throws {
if let container = try? decoder.container(keyedBy: JSONCodingKeys.self) {
self = JSON(from: container)
@crsantos
crsantos / ServiceLocator.swift
Last active May 26, 2020 14:52 — forked from FGoessler/ServiceLocator.swift
A very lightweight ServiceLocator implementation including a module mechanism written in Swift.
import Foundation
public typealias ServiceFactoryClosure<Service> = () -> Service
public protocol ServiceLocatorModule {
func registerServices(_ serviceLocator: ServiceLocator)
}
public class ServiceLocator {
@jamieweavis
jamieweavis / macos-app-icon.md
Last active June 16, 2024 22:18
How to create an .icns macOS app icon
@zmts
zmts / tokens.md
Last active June 24, 2024 00:49
Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Last major update: 25.08.2020

  • Что такое авторизация/аутентификация
  • Где хранить токены
  • Как ставить куки ?
  • Процесс логина
  • Процесс рефреш токенов
  • Кража токенов/Механизм контроля токенов