Skip to content

Instantly share code, notes, and snippets.

View fitomad's full-sized avatar
👋
Swift + ML & DL + Azure + AWS

Adolfo fitomad

👋
Swift + ML & DL + Azure + AWS
View GitHub Profile
@fitomad
fitomad / swift-parameter_packs.swift
Created June 7, 2023 14:34
A Swift's parameter packs new feature example
View swift-parameter_packs.swift
import Foundation
struct Query<Element> {
let key: String
let value: Element
var filter: String {
return "\(key)=\(String(describing: value))"
}
}
View cor-message-handler.swift
final class VoyagerMessageHandler: MessageHandler {
var nextHandler: MessageHandler?
func process(_ message: String) throws {
let regex = #/^VYYR\s{1,4}(?<id>\d{1})\s{1,4}(?<distance>\d{1,}\.\d{1,3})\s{1,}/#
let match = try regex.firstMatch(in: message)
if let match {
print("🛸 La sonda Voyager \(match.id) se encuentra a \(match.distance) millones de kilómetros")
} else if let nextHandler {
View cor-message-manager.swift
final class MessageManager {
private var handlers: [MessageHandler]
init() {
handlers = [
OrionMessageHandler(),
VoyagerMessageHandler(),
PerseveranceMessageHandler()
]
View cor-handler-protocol.swift
protocol MessageHandler {
var nextHandler: MessageHandler? { get set }
func process(_ message: String) throws
}
@fitomad
fitomad / SwiftUI-previews-delete.sh
Last active October 4, 2022 11:32
Delete Xcode SwiftUI Previews in a Secure Way
View SwiftUI-previews-delete.sh
#!/bin/zsh
# Close Xcode, then run this script
xcrun simctl --set previews delete all
View Xcode Simulator.md

Screenshots

Hacer una captuta de pantalla del simulator encendido

xcrun simctl io booted screenshot [filename].[extension]

Vídeo

View Git cheatsheet.md

Crear un branch local y subirlo a remoto

git branch NEW-BRANCH-NAME
git push -u origin <branch>

Renombrar un branch local

git branch -m nuevo_nombre
View KeyboardResponder.swift
//
// KeyboardResponder.swift
// MoveMAD
//
// Created by Adolfo Vera Blasco on 19/11/2019.
// Copyright © 2019 desappstre {eStudio}. All rights reserved.
//
import Combine
import SwiftUI
@fitomad
fitomad / KeyboardResponder.swift
Created November 22, 2019 19:23
Manage iOS keyboard presentation and dismiss with your SwiftUI views.
View KeyboardResponder.swift
//
// KeyboardResponder.swift
// MoveMAD
//
// Created by Adolfo Vera Blasco on 19/11/2019.
// Copyright © 2019 desappstre {eStudio}. All rights reserved.
//
import SwiftUI
View perfect_app_store_screenshot.sh
#!/bin/zsh
# The right time
xcrun simctl status_bar booted override --time 09:41
# WiFi & Cellular network
xcrun simctl status_bar booted override --dataNetwork wifi
xcrun simctl status_bar booted override --wifiBars 3
xcrun simctl status_bar booted override --cellularBars 4
# 100% battery level
xcrun simctl status_bar booted override --batteryLevel 100