Skip to content

Instantly share code, notes, and snippets.

View enzosterro's full-sized avatar

Enzo Sterro enzosterro

  • Thomson Reuters
View GitHub Profile
@Sherlouk
Sherlouk / DebugDevice.swift
Last active June 6, 2024 19:38
Debug Profiles - Securely debugging in production
//
// DebugDevice.swift
//
// Copyright 2022 • Sidetrack Tech Limited
//
import Foundation
// This must be called on the main-thread.
var isDebugProfileInstalled: Bool {
@CodeSlicing
CodeSlicing / custom-shortcuts.txt
Last active December 16, 2021 07:33
Dictionary entries for CodeSlicing episode on custom shortcuts
<key>User Defined</key>
<dict>
<key>Insert New Line Above Current Line</key>
<string>moveUp:, moveToEndOfLine:, insertNewline:</string>
<key>Insert New Line Below Current Line</key>
<string>moveToEndOfLine:, insertNewline:</string>
<key>Duplicate Current Lines Down</key>
<string>selectParagraph:, delete:, yank:, moveToBeginningOfParagraph:, yank:, moveUp:, moveToEndOfParagraph:</string>
</dict>
@codelynx
codelynx / UIKit+swizzling.swift
Created March 17, 2021 09:10
Example of swizzling UIKit classes
//
// UIKit+swizzling.swift
//
// The MIT License (MIT)
//
// Copyright (c) 2022 Electricwoods LLC, Kaz Yoshikawa.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
@nicholaslythall
nicholaslythall / Middleware.swift
Created April 27, 2018 02:41
Basic middleware implementation in swift
import Foundation
class MiddlewareStack<T, U> {
typealias Next = (T) -> U
typealias Layer = (T, Next) -> U
private var layers = [Layer]()
private let center: Next
private var stack: Next
@onevcat
onevcat / Delegate.swift
Last active December 23, 2022 07:21
An auto-weak delegate for handle modern delegate pattern.
import Foundation
/// A class that keeps a weakly reference for `self` when implementing `onXXX` behaviors.
/// Instead of remembering to keep `self` as weak in a stored closure:
///
/// ```swift
/// // MyClass.swift
/// var onDone: (() -> Void)?
/// func done() {
/// onDone?()
ACTION
AD_HOC_CODE_SIGNING_ALLOWED
ALTERNATE_GROUP
ALTERNATE_MODE
ALTERNATE_OWNER
ALWAYS_SEARCH_USER_PATHS
ALWAYS_USE_SEPARATE_HEADERMAPS
APPLE_INTERNAL_DEVELOPER_DIR
APPLE_INTERNAL_DIR
APPLE_INTERNAL_DOCUMENTATION_DIR
@adamawolf
adamawolf / Apple_mobile_device_types.txt
Last active July 16, 2024 01:33
List of Apple's mobile device codes types a.k.a. machine ids (e.g. `iPhone1,1`, `Watch1,1`, etc.) and their matching product names
i386 : iPhone Simulator
x86_64 : iPhone Simulator
arm64 : iPhone Simulator
iPhone1,1 : iPhone
iPhone1,2 : iPhone 3G
iPhone2,1 : iPhone 3GS
iPhone3,1 : iPhone 4
iPhone3,2 : iPhone 4 GSM Rev A
iPhone3,3 : iPhone 4 CDMA
iPhone4,1 : iPhone 4S