You may need to configure a proxy server if you're having trouble cloning
or fetching from a remote repository or getting an error
like unable to access '...' Couldn't resolve host '...'.
Consider something like:
| import SwiftUI | |
| struct ScrollableView<Content: View>: UIViewControllerRepresentable, Equatable { | |
| // MARK: - Coordinator | |
| final class Coordinator: NSObject, UIScrollViewDelegate { | |
| // MARK: - Properties | |
| private let scrollView: UIScrollView | |
| var offset: Binding<CGPoint> |
| curl -I -k "https://api.github.com/repos/:owner/:repo/commits?per_page=1" | sed -n '/^[Ll]ink:/ s/.*"next".*page=\([0-9]*\).*"last".*/\1/p' | |
| ### And that's all ! | |
| # I saw many fighting with finding first commit SHA or similar fancy thing. | |
| # Here we just rely on the GH API, asking commits at 1 per page and parsing the last page number in the header of the reply (whose body only holds the last commit !) | |
| # So this is robust and bandwidth efficient. :) | |
| # If one want the commit count of a specific SHA, just use : | |
| curl -I -k "https://api.github.com/repos/:owner/:repo/commits?per_page=1&sha=:sha" | sed -n '/^[Ll]ink:/ s/.*"next".*page=\([0-9]*\).*"last".*/\1/p' |
| // | |
| // ViewController.swift | |
| // CertificateRequest | |
| // | |
| // Created by Glen Hinkle on 3/4/19. | |
| // Copyright © 2019 Zombie Dolphin LLC. All rights reserved. | |
| // | |
| // Works with iOS 12 | |
| // |
| public struct Units { | |
| public let bytes: Int64 | |
| public var kilobytes: Double { | |
| return Double(bytes) / 1_024 | |
| } | |
| public var megabytes: Double { | |
| return kilobytes / 1_024 |
| public func CVPixelBufferGetPixelFormatName(pixelBuffer: CVPixelBuffer) -> String { | |
| let p = CVPixelBufferGetPixelFormatType(pixelBuffer) | |
| switch p { | |
| case kCVPixelFormatType_1Monochrome: return "kCVPixelFormatType_1Monochrome" | |
| case kCVPixelFormatType_2Indexed: return "kCVPixelFormatType_2Indexed" | |
| case kCVPixelFormatType_4Indexed: return "kCVPixelFormatType_4Indexed" | |
| case kCVPixelFormatType_8Indexed: return "kCVPixelFormatType_8Indexed" | |
| case kCVPixelFormatType_1IndexedGray_WhiteIsZero: return "kCVPixelFormatType_1IndexedGray_WhiteIsZero" | |
| case kCVPixelFormatType_2IndexedGray_WhiteIsZero: return "kCVPixelFormatType_2IndexedGray_WhiteIsZero" | |
| case kCVPixelFormatType_4IndexedGray_WhiteIsZero: return "kCVPixelFormatType_4IndexedGray_WhiteIsZero" |
| In the next version of iPulse, I'd like to show GPU statistics. Unfortunately, the format | |
| for these statistics is vendor specfic (see the "Performance Statistics" dictionary below.) | |
| In order to cover as many devices as possible, I'd like you to run the following commands | |
| from your Terminal: | |
| $ sysctl hw.model | |
| $ ioreg -r -d 1 -w 0 -c "IOAccelerator" | |
| You can help me read the results by putting them in a code block (triple backticks). |
| -(UIImage *)imageWithTint:(UIImage *)image andTintColor:(UIColor *)tintColor { | |
| UIImage *imageNew = [image imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]; | |
| UIImageView *imageView = [[UIImageView alloc] initWithImage:imageNew]; | |
| imageView.tintColor = tintColor; | |
| UIGraphicsBeginImageContextWithOptions(imageView.bounds.size, NO, 0.0); | |
| [imageView.layer renderInContext:UIGraphicsGetCurrentContext()]; | |
| UIImage *tintedImage = UIGraphicsGetImageFromCurrentImageContext(); | |
| UIGraphicsEndImageContext(); | |