Skip to content

Instantly share code, notes, and snippets.

View Fiser12's full-sized avatar
🎯
Focusing

Rubén García Fiser12

🎯
Focusing
View GitHub Profile
import Combine
import ComposableArchitecture
import KeyboardShortcuts
public struct KeyboardShortcutManager {
public enum Action: Equatable {
case onKeyDown(UUID)
case onKeyUp(UUID)
}
@Fiser12
Fiser12 / NOTION_POWERSHELL_INBOX_SHORTCUT.md
Last active April 13, 2022 14:46
How to create a fast inbox that send your notes to the notion API

How to configure the script?

You should add a shortcut that points to the file location

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -File C:\Users\USER\Desktop\notion-inbox.ps1

import SwiftUI
struct DatePickerNullable: View {
let title: String
@Binding var selected: Date?
let defaultDate: Date
var body: some View {
HStack {
if let date = Binding($selected) {
@Fiser12
Fiser12 / SwiftUIExtension.swift
Created January 20, 2023 12:13
SwiftUI if else modifiers
extension View {
@ViewBuilder func `if`<Content: View>(_ condition: Bool, transform: (Self) -> Content) -> some View {
if condition {
transform(self)
} else {
self
}
}
@ViewBuilder func `if`<Content: View, ContentElse: View>(
@Fiser12
Fiser12 / KeychainWrapper.swift
Last active February 21, 2023 17:19
I have created a simplified version of KeychainAccess that allows you to just mark a property of a class like @KeychainWrapper("tag"), to store it under a tag as long as it implements Codable. This makes it very easy to make use of the Keychain.
// I got inspiration in this repository https://github.com/kishikawakatsumi/KeychainAccess
// This is a great library that is backward compatible with very old versions of iOS and macOS and gives you a very complete wrapper of the Keychain
// But it was too much for me, since I didn't need neither that backward compatibility nor so many features, I just wanted to keep Codable secrets in the Keychain.
// So I have made my own version, also implementing a Property Wrapper to make it agnostic to use.
// I have thus reduced the 3000 lines of KeychainAccess to less than 200 and I have made its use for the functions I was interested in much more agile and integrated with SwiftUI,
// KeychainWrapper.swift
// SyncTion (macOS)
//
// Created by Rubén on 20/2/23.
//
@propertyWrapper
public struct AnyProxy<EnclosingSelf, Value> {
private let keyPath: ReferenceWritableKeyPath<EnclosingSelf, Value>
public init(_ keyPath: ReferenceWritableKeyPath<EnclosingSelf, Value>) {
self.keyPath = keyPath
}
@available(*, unavailable, message: "The wrapped value must be accessed from the enclosing instance property.")
public var wrappedValue: Value {
@Fiser12
Fiser12 / README.md
Created March 10, 2023 21:59 — forked from IsaacXen/README.md
(Almost) Every WWDC videos download links for aria2c.
//
// main.swift
// Philosofers problem with actors (monitors)
//
//
import Foundation
let TiempoDeComer: UInt64 = 2_000_000_000
let TiempoDePensar: UInt64 = 1_000_000_000
@Fiser12
Fiser12 / AVLTree.swift
Created April 11, 2023 23:10
AVLTree in swift for store data in a efficient way
final class AVLTree<Element: Comparable> {
private var value: Element?
private var left: AVLTree<Element>?
private var right: AVLTree<Element>?
private var balanceFactor: Int8 = 0
private var height: Int
init() {
height = (value == nil) ? 0 : 1
@Fiser12
Fiser12 / semantic-commit-messages.md
Last active January 24, 2024 10:20 — forked from joshbuchea/semantic-commit-messages.md
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example