This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// VoronoiFlowGradient and the related sources | |
// Copyright (c) 2024 Astemir Eleev | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a copy | |
// of this software and associated documentation files (the "Software"), to deal | |
// in the Software without restriction, including without limitation the rights | |
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
// copies of the Software, and to permit persons to whom the Software is | |
// furnished to do so, subject to the following conditions: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
public extension UIImage { | |
func image(uniformInset inset: CGFloat) -> UIImage? { | |
image(with: | |
UIEdgeInsets( | |
top: inset, | |
left: inset, | |
bottom: inset, | |
right: inset |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git branch -m old_branch new_branch # First, rename branch locally | |
git push origin :old_branch # Then, delete the outdated branch | |
git push --set-upstream origin new_branch # And finally, push the new branch. Also, the new remote needs to be tracked, that is why we set set local branch to do so. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UIFont: family Thonburi | |
UIFont: font Thonburi-Bold | |
UIFont: font Thonburi | |
UIFont: font Thonburi-Light | |
UIFont: family Khmer Sangam MN | |
UIFont: font KhmerSangamMN | |
UIFont: family Snell Roundhand | |
UIFont: font SnellRoundhand-Black | |
UIFont: font SnellRoundhand-Bold | |
UIFont: font SnellRoundhand |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Carbon | |
struct KeyCode { | |
static let a = UInt16(kVK_ANSI_A) | |
static let b = UInt16(kVK_ANSI_B) | |
static let c = UInt16(kVK_ANSI_C) | |
static let d = UInt16(kVK_ANSI_D) | |
static let e = UInt16(kVK_ANSI_E) | |
static let f = UInt16(kVK_ANSI_F) | |
static let g = UInt16(kVK_ANSI_G) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public extension DispatchQueue { | |
// MARK: - Properties | |
private static var _onceTracker = [String]() | |
// MARK: - Methods | |
/// Executes a block of code, associated with a unique token, only once. The code is thread safe and will onle execute the code once even in the presence of multithreaded calls. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension UIImage { | |
class func resize(_ image: UIImage, newWidth: CGFloat) -> UIImage? { | |
let scale = newWidth / image.size.width | |
let newHeight = image.size.height * scale | |
UIGraphicsBeginImageContext(CGSize(width: newWidth, height: newHeight)) | |
image.draw(in: CGRect(x: 0, y: 0, width: newWidth, height: newHeight)) | |
let newImage = UIGraphicsGetImageFromCurrentImageContext() | |
UIGraphicsEndImageContext() | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension UIImage { | |
class func imageOrientationToTiffOrientation(_ value: UIImageOrientation) -> Int32 { | |
switch (value) { | |
case .up: | |
return 1 | |
case .down: | |
return 3 | |
case .left: | |
return 8 | |
case .right: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func landscapeCameraCaptureOrientationFix(for interfaceOrinetation: UIInterfaceOrientation) -> UIImage? { | |
var imageOrientation: UIImageOrientation! | |
var shouldOrient: Bool = false | |
if interfaceOrinetation == .landscapeRight { | |
imageOrientation = UIImageOrientation.left | |
shouldOrient = !shouldOrient | |
} else if interfaceOrinetation == .landscapeLeft { | |
imageOrientation = UIImageOrientation.right |
NewerOlder