Skip to content

Instantly share code, notes, and snippets.

View takiguri's full-sized avatar

Iñaki Narciso takiguri

  • CodeWithChris
View GitHub Profile
@takiguri
takiguri / multiple_ssh_setting.md
Created April 14, 2023 06:03 — forked from jexchan/multiple_ssh_setting.md
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "[email protected]"
@takiguri
takiguri / swift-ui-protocol-view-models.swift
Created March 12, 2022 14:49 — forked from neilsmithdesign/swift-ui-protocol-view-models.swift
SwiftUI views with protocol interfaces to view models.
import SwiftUI
/// View model protocol
protocol ViewModel: ObservableObject {
var count: Int { get }
func increase()
}
/// Concrete implementation
class MyViewModel: ViewModel {
@takiguri
takiguri / BookingsController.swift
Created October 9, 2021 06:44
UICollectionViewCompositionalLayout example: BookingsController
import Foundation
import UIKit
import Rswift
import RxCocoa
import RxSwift
import StatefulCollectionView
class BookingsController: ViewController {
var viewModel: BookingsViewModelProtocol!
@takiguri
takiguri / Files.swift
Created January 28, 2021 01:38
Allow app to access Files app by creating its own app folder using the FileManager framework
/**
Step 1: info.plist, set:
UIFileSharingEnabled = YES
LSSupportsOpeningDocumentsInPlace = YES
*/
/**
Step 2: I used a pod that is a thin wrapper over FileManager, created by Sundell
Podfile, set
pod 'Files', '~> 4.0.2'
@takiguri
takiguri / UIControl+CenterTapLocation.swift
Created January 14, 2021 01:35
Locates the distance of the center of all subviews from the tap location of a UIControl, and returns the subview with the closest center to tap location.
class SomeControl: UIControl {
private var tapGestureRecognizer: UITapGestureRecognizer!
func setupGestureRecognizer() {
tapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(tapped(_:)))
addGestureRecognizer(tapGestureRecognizer)
}
@objc func tapped(_ gestureRecognizer: UITapGestureRecognizer) {
let location = gestureRecognizer.location(in: self)
@takiguri
takiguri / keymap.cson
Created November 8, 2020 11:18 — forked from 3lvis/keymap.cson
Xcode keymap for Atom
# Your keymap
#
'body':
'ctrl-tab': 'pane:show-next-item'
'alt-cmd-up': 'pane:split-up'
'alt-cmd-down': 'pane:split-down'
'shift-cmd-L': 'application:open-dev'
'shift-cmd-0': 'window:reset-font-size'
'.platform-darwin':
import UIKit
typealias JSON = [String : Any]
fileprivate let imageCache = NSCache<NSString, UIImage>()
extension NSError {
static func generalParsingError(domain: String) -> Error {
return NSError(domain: domain, code: 400, userInfo: [NSLocalizedDescriptionKey : NSLocalizedString("Error retrieving data", comment: "General Parsing Error Description")])
}
}
@takiguri
takiguri / non-head-amend.git
Created July 9, 2018 19:25
Amending non-head commits
sh: git rebase 'commit-hash-to-amend^'
text editor: replace 'pick' to 'edit' on the target commit hash.
text editor: save and quit
code: Apply all changes to amend.
sh: git commit --all --amend --no-edit
sh: git rebase --continue
@takiguri
takiguri / .vimrc
Created June 18, 2018 14:36
vim dotfile
set number
syntax on
set tabstop=2
set autoindent
@takiguri
takiguri / hero.h
Last active June 15, 2018 09:42
C++ Header Guards
#ifndef HERO_H
#define HERO_H
////////////////////////////////////////////////////////////////////////////////
class Hero {
int power;
public:
void hyperspaceJump(int);
};