Skip to content

Instantly share code, notes, and snippets.

@rahularity
rahularity / work-with-multiple-github-accounts.md
Last active April 21, 2025 22:13
How To Work With Multiple Github Accounts on your PC

How To Work With Multiple Github Accounts on a single Machine

Let suppose I have two github accounts, https://github.com/rahul-office and https://github.com/rahul-personal. Now i want to setup my mac to easily talk to both the github accounts.

NOTE: This logic can be extended to more than two accounts also. :)

The setup can be done in 5 easy steps:

Steps:

  • Step 1 : Create SSH keys for all accounts
  • Step 2 : Add SSH keys to SSH Agent
class BlueView: UIView {
var myLabel = UILabel()
// init from code
override init(frame: CGRect) {
super.init(frame: frame)
setupView()
}
// init from xib or storyboard
required init?(coder aDecoder: NSCoder) {
@stevencurtis
stevencurtis / loadViewExample
Created May 12, 2020 08:09
loadViewExample
import UIKit
import PlaygroundSupport
final class MyViewController: UIViewController {
override func loadView() {
let view = ButtonView()
view.button.addTarget(self, action: #selector(buttonDidTap), for: .touchDown)
self.view = view
}
@xtabbas
xtabbas / SnapCarousel.swift
Created May 10, 2020 18:13
A carousel that snap items in place build on top of SwiftUI
//
// SnapCarousel.swift
// prototype5
//
// Created by xtabbas on 5/7/20.
// Copyright © 2020 xtadevs. All rights reserved.
//
import SwiftUI
@mdiep
mdiep / diff-values.swift
Created February 4, 2020 13:02
Diff values with Mirror and AnyHashable
import Foundation
// Diff values for better test assertions.
//
// Enums and collections left as an exercise for the reader.
// A difference between two values
struct Difference: CustomStringConvertible {
let path: String
let actual: String
@konnnn
konnnn / UILabel+Padding.swift
Last active February 22, 2024 13:24
Swift 4: Adding space/padding to a UILabel Programmatically and Storyboard
/*
If you use Storyboard, don't forget to set UIlabel to PaddingLabel
*/
import UIKit
class PaddingLabel: UILabel {
var topInset: CGFloat
var bottomInset: CGFloat
@iamchiwon
iamchiwon / UIPickerController+Rx.swift
Last active November 30, 2022 10:46
DelegateProxy example
// MARK:- UIImagePickerController.rx
import UIKit
import RxSwift
import RxCocoa
// picker.rx.didFinishPickingMediaWithInfo
// ~~~~~~ ~~
// Base Reactive
import Foundation
import UIKit
struct ViewStyle<T> {
let style: (T) -> Void
}
let filled = ViewStyle<UIButton> {
$0.setTitleColor(.white, for: .normal)
$0.backgroundColor = .red
import Cocoa
precedencegroup PipeOperatorPrecedence {
associativity: left
higherThan: LogicalConjunctionPrecedence
}
infix operator |>: PipeOperatorPrecedence
public func |> <A, B>(arg: A,
prefix func ~<A>(_ keyPath: KeyPath<A, Bool>) -> (A) -> Bool {
return { $0[keyPath: keyPath] }
}
// only people with empty street in their address
people.filter(~\.address.street.isEmpty)
// the names of the people with empty street
people.filter(~\.address.street.isEmpty).map(~\.name)
// => ["Tom", "Alice", "Bob"]