Skip to content

Instantly share code, notes, and snippets.

View rafaelcrz's full-sized avatar

Rafael Felipe rafaelcrz

  • Netshoes
  • São Paulo, Brazil
View GitHub Profile
@rafaelcrz
rafaelcrz / ssh.md
Created July 18, 2023 14:45 — forked from EdnilsonRobert/ssh.md
Múltiplas chaves SSH para GitHub e GitLab

Múltiplas chaves SSH para GitHub e GitLab

1. Gerar Chaves SSH

ssh-keygen -t rsa -C "user@email.com" -b 4096 -f ~/.ssh/id_rsa_github
ssh-keygen -t rsa -C "user@email.com" -b 4096 -f ~/.ssh/id_rsa_gitlab

2. Copiar chaves para GitHub e GitLab

extension Font {
static func rounded(_ style: Font.TextStyle = .body, weight: Font.Weight = .semibold) -> Font {
return .system(size: style.size, weight: weight, design: .rounded)
}
}
extension Font.TextStyle {
var size: CGFloat {
switch self {
case .largeTitle: return 60
CKContainer.default().requestApplicationPermission(.userDiscoverability) { status, error in
guard status == .granted, error == nil else {
// error handling voodoo
return
}
CKContainer.default().discoverUserIdentity(withUserRecordID: recordID) { identity, error in
guard let components = identity?.nameComponents, error == nil else {
// more error handling magic
return
@rafaelcrz
rafaelcrz / eliza.swift
Created July 7, 2021 00:31 — forked from hollance/eliza.swift
The classic ELIZA chat bot in Swift.
/*
Joseph Weizenbaum's classic ELIZA chat bot in Swift.
Based on the IBM PC BASIC program from CREATIVE COMPUTING by Patricia
Danielson and Paul Hashfield, and the Java adaptation by Jesper Juul.
Run this script from Terminal:
$ swift eliza.swift
Press Ctrl-C or Ctrl-D to quit. (Or type "shut up".)
Para um serviço que precisa ser executado em um intervalo de tempo
Timer.scheduledTimer
@rafaelcrz
rafaelcrz / UITextField+BarButton.swift
Created December 2, 2019 13:50
add bar button on keyboard
extension UITextField {
func addDoneButtonOnKeyboard(actionBefore: Selector, actionNext: Selector, actionDone: Selector) {
guard let windowFrame = UIApplication.shared.keyWindow?.frame else {
return
}
let keyToolbar = UIToolbar(frame: CGRect(origin: .zero, size: CGSize(width: windowFrame.width, height: 45)))
keyToolbar.barStyle = .default
let flexSpace = UIBarButtonItem(barButtonSystemItem: .flexibleSpace, target: nil, action: nil)
let next = UIBarButtonItem(title: "próximo", style: .plain, target: nil, action: actionNext)
let before = UIBarButtonItem(title: "anterior", style: .plain, target: nil, action: actionBefore)