Skip to content

Instantly share code, notes, and snippets.

View Arcovv's full-sized avatar
🎯
Focusing

Arco Hsieh Arcovv

🎯
Focusing
View GitHub Profile
@Arcovv
Arcovv / k9s.txt
Created May 18, 2023 17:11 — forked from BigNerd/k9s.txt
K9s column descriptions
View: Pods(<namespace>)[number of pods listed]
NAME pod name
READY number of pods in ready state / number of pods to be in ready state
RESTARTS number of times the pod has been restarted so far
STATUS state of the pod life cycle, such as Running | ... | Completed
CPU current CPU usage, unit is milli-vCPU
MEM current main memory usage, unit is MiB
%CPU/R current CPU usage as a percentage of what has been requested by the pod
%MEM/R current main memory usage as a percentage of what has been requested by the pod
@Arcovv
Arcovv / processGyb.sh
Created January 31, 2019 03:06
Process Gyb Files in Swift Source Code
#!/bin/bash
for f in `ls *.gyb`
do
echo "Processing $f"
name=${f%.gyb}
../../../utils/gyb -D CMAKE_SIZEOF_VOID_P=8 -o $name $f --line-directive ""
done
@Arcovv
Arcovv / DecodeIfPresent.swift
Created November 30, 2018 03:53
Test `decodeIfPresent(_:forKey:)`
import Foundation
let bothValues = """
{
"key": "1",
"value": "111"
}
""".data(using: .utf8)!
let valueNull = """
@Arcovv
Arcovv / MimeType.swift
Created September 22, 2018 03:14
Get mime type using MobileCoreServices framework
import MobileCoreServices
fileprivate let defaultMimeType = "application/octet-stream"
protocol PathExtensionable {
var pathExtension: String? { get }
}
extension URL : PathExtensionable {
var pathExtension: String? {
@Arcovv
Arcovv / operation.swift
Last active November 22, 2023 21:56
Operation and OperationQueue example
//
// PhotoOperations.swift
// ClassicPhotos
//
// Created by jos on 1/19/17.
// Copyright © 2017 raywenderlich. All rights reserved.
//
import Foundation
import UIKit
@Arcovv
Arcovv / UIImage+Extension.swift
Last active August 24, 2017 10:12
Some of the small methods to handle UIImage
import UIKit
extension UIImage {
func fill(with color: UIColor) -> UIImage? {
UIGraphicsBeginImageContextWithOptions(size, false, UIScreen.main.scale)
guard let context = UIGraphicsGetCurrentContext(), let cgImage = cgImage else { return nil }
let rect = CGRect(origin: .zero, size: size)
extension RawRepresentable where RawValue == Int {
static var itemsCount: Int {
var index = 0
while Self(rawValue: index) != nil { index += 1 }
return index
}
static var items: [Self] {
var items: [Self] = []
@Arcovv
Arcovv / Class.swift
Last active November 21, 2018 08:20
Personal Swift Code template
import Foundation
final class ___FILEBASENAMEASIDENTIFIER___ {
// MARK: Public
// MARK: Initial
deinit {
print("\(type(of: self)) deinit")
@Arcovv
Arcovv / CrashlyticsSwift.Swift
Created October 1, 2016 13:32 — forked from DimaVartanian/CrashlyticsSwift.Swift
Crashlytics CLS_LOG() in Swift
//
// Created by Dima Vartanian on 10/29/15.
//
import Foundation
import Crashlytics
// this method gives us pretty much the same functionality as the CLS_LOG macro, but written as a Swift function, the only differences are that we have to use array syntax for the argument list and that we don't get see if the method being called is a class method or an instance method. We also have to define the DEBUG compiler flag with -D SWIFT_DEBUG.
// usage: