This file contains hidden or 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
| // | |
| // UIColor+Utils.swift | |
| // | |
| // Created by Yozone Wang on 15/12/17. | |
| // Copyright © 2015年 Yozone Wang. All rights reserved. | |
| // | |
| import UIKit | |
| private let UIColorCache = NSCache() |
This file contains hidden or 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
| componentDidUpdate(prevProps) { | |
| console.log('Rrow update diff:'); | |
| const now = Object.entries(this.props); | |
| const added = now.filter(([key, val]) => { | |
| if (prevProps[key] === undefined) return true; | |
| if (prevProps[key] !== val) { | |
| console.log(`${key} | |
| - ${JSON.stringify(val)} |
This file contains hidden or 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 zalgo(_ string: String, intensity: Int = 5) -> String { | |
| let combiningDiacriticMarks = 0x0300...0x036f | |
| let latinAlphabetUppercase = 0x0041...0x005a | |
| let latinAlphabetLowercase = 0x0061...0x007a | |
| var output: [UnicodeScalar] = [] | |
| for scalar in string.unicodeScalars { | |
| output.append(scalar) | |
| guard (latinAlphabetUppercase).contains(numericCast(scalar.value)) || | |
| (latinAlphabetLowercase).contains(numericCast(scalar.value)) |
This file contains hidden or 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 Foundation | |
| import CoreGraphics | |
| import UIKit | |
| extension UIBezierPath { | |
| convenience init?(quadCurve points: [CGPoint]) { | |
| guard points.count > 1 else { return nil } | |
| self.init() |
This file contains hidden or 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
| <!-- Add this file to: ~/Library/Developer/Xcode/UserData/FontAndColorThemes (Create folder if does not exist)--> | |
| <?xml version="1.0" encoding="UTF-8"?> | |
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
| <plist version="1.0"> | |
| <dict> | |
| <key>DVTConsoleDebuggerInputTextColor</key> | |
| <string>0.901961 0.831373 0.639216 1</string> | |
| <key>DVTConsoleDebuggerInputTextFont</key> | |
| <string>SFMono-Bold - 11.0</string> | |
| <key>DVTConsoleDebuggerOutputTextColor</key> |
This file contains hidden or 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
| // Authoer: The SwiftUI Lab | |
| // Full article: https://swiftui-lab.com/scrollview-pull-to-refresh/ | |
| import SwiftUI | |
| struct RefreshableScrollView<Content: View>: View { | |
| @State private var previousScrollOffset: CGFloat = 0 | |
| @State private var scrollOffset: CGFloat = 0 | |
| @State private var frozen: Bool = false | |
| @State private var rotation: Angle = .degrees(0) |
This file contains hidden or 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 Sequence { | |
| func all(_ predicate: (Element) throws -> Bool) rethrows -> Bool { | |
| try allSatisfy(predicate) | |
| } | |
| func any(_ predicate: (Element) throws -> Bool) rethrows -> Bool { | |
| try contains(where: predicate) | |
| } | |
| } |
This file contains hidden or 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 SwiftUI | |
| import PlaygroundSupport | |
| extension Double { | |
| func toRadians() -> Double { | |
| return self * Double.pi / 180 | |
| } | |
| func toCGFloat() -> CGFloat { | |
| return CGFloat(self) |
This file contains hidden or 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 SwiftUI | |
| // View to split up a string into Text views, split by spaces. | |
| struct ContentText: View { | |
| private var splitText: [String] | |
| let count: Int | |
| init(_ text: String) { | |
| self.splitText = text.split(separator: " ").map { "\($0) " } | |
| if text.hasPrefix(" ") { |
This file contains hidden or 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
| # after the virtual disk has already been expanded (e.g. in proxmox) | |
| apk add --no-cache cfdisk e2fsprogs-extra | |
| # choose partition then "Resize" > "Write" (to finalize) | |
| cfdisk | |
| # replace * with partition you are resizing | |
| resize2fs /dev/* |