Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View efremidze's full-sized avatar
👨‍💻

Lasha Efremidze efremidze

👨‍💻
View GitHub Profile
@efremidze
efremidze / gist:a13ffc471313928256f23e0573b93ccb
Created October 26, 2023 20:57
Authenticating SourceTree with GitHub
To authenticate SourceTree with GitHub, follow the steps below. This will allow you to access and manage your GitHub repositories through SourceTree seamlessly.
1. Generate Personal Access Token in GitHub:
- Login to your GitHub account.
- Select Settings from the dropdown.
- In the left sidebar, click on Developer settings.
- Click on Personal access tokens in the left sidebar under Developer settings.
- Fill out the form by giving your token a descriptive name and selecting the necessary scopes (permissions). For using SourceTree, it's recommended to grant the repo scope at a minimum.
- Click the Generate token button at the bottom.
- Once generated, make sure to copy your new Personal Access Token to a secure location. You won’t be able to see it again.
@efremidze
efremidze / Install PIP to user site on macOS.md
Last active February 10, 2023 07:40 — forked from haircut/Install PIP to user site on macOS.md
How to install and use pip without sudo or admin on macOS

Install and use pip on macOS without sudo / admin access

Most recently tested on macOS Sierra (10.12.6)

  1. Install pip using Homebrew: brew install python.
  2. Verify installation by running pip3 --version and copy path for next step.
  3. Make sure ~/Library/Python/3.9/bin is in your $PATH. For bash users, edit the PATH= line in ~/.bashrc to append the local Python path; ie. export PATH=$PATH:~/Library/Python/3.9/bin. Apply the changes, source ~/.bashrc.

Links

https://www.groovypost.com/howto/install-pip-on-a-mac/

class Counter<T: Hashable> {
let id: T
private(set) var count: Int = 0
init(id: T) {
self.id = id
}
func increment() {
count += 1
}
}
extension UIStackView {
func reverseZIndex() {
for view in arrangedSubviews {
sendSubview(toBack: view)
}
}
}
extension UIView {
func hasSuperview(_ superview: UIView) -> Bool {
var view = self
while let _view = view.superview {
defer { view = _view }
if _view === superview {
return true
}
}
return false
import ActiveLabel
class ViewController: UIViewController {
lazy var footerView: UIView = {
let label = ActiveLabel()
label.customize { label in
label.text = "Tap me"
label.textAlignment = .center
let customType = ActiveType.custom(pattern: "\\bTap me\\b")
label.enabledTypes = [customType]
class TableSectionHeader: UITableViewHeaderFooterView {
override func layoutSubviews() {
super.layoutSubviews()
textLabel?.frame.origin.y = 16
}
}
enum Section {
case profile(Row0)
case privacy(Row1)
enum Row0: Int {
case name, username, password
}
enum Row1: Int {
case email, phone, gender
}
}
import UIKit
let keyPath = "continuous" + "Corners"
extension CALayer {
var infiniteCorners: Bool {
get { return value(forKeyPath: keyPath) as! Bool }
set { setValue(newValue, forKeyPath: keyPath) }
}
}
import UIKit
class RadialGradientLayer: CALayer {
var colors = [CGColor]() { didSet { setNeedsDisplay() } }
var locations: [CGFloat]?
override func draw(in ctx: CGContext) {
ctx.saveGState()
guard let gradient = CGGradient(colorsSpace: nil, colors: colors as CFArray, locations: locations) else { return }
let center = CGPoint(x: bounds.width / 2, y: bounds.height / 2)
ctx.drawRadialGradient(gradient, startCenter: center, startRadius: 0, endCenter: center, endRadius: radius, options: .drawsBeforeStartLocation)