Skip to content

Instantly share code, notes, and snippets.

Reddit Dec 5, 2022 10:46 AM:

Hi Christian,

I hope all is well!

I’m reaching out because we noticed a spike in Apollo's request rate on December 2nd. It was from approximately 14:17 to 14:23 UTC to /messages/inbox that went up by around 35% before returning to baseline. We are hoping you could help us understand what might have happened.

The source IPs were in AWS us-west-2: redacted, redacted, and redacted and had the Apollo UA server:apollo-backend:v1.0 (by /u/iamthatis) contact [email protected]

extension UserDefaults {
func favoriteSubreddits() -> [String] {
return stringArray(forKey: DefaultsKeys.favoriteSubreddits) ?? []
}
}
import UIKit
var startTime: CFAbsoluteTime!
class ViewController: UIViewController {
let movingView = UIView()
override func viewDidLoad() {
super.viewDidLoad()
import UIKit
import UIKit.UIGestureRecognizerSubclass
class ViewController: UIViewController {
let flickView = UIView()
var propertyAnimator: UIViewPropertyAnimator?
override func viewDidLoad() {
super.viewDidLoad()
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let separatorLine = UIView(frame: CGRect(x: 50.0, y: 0.0, width: 1.0, height: view.bounds.height))
separatorLine.backgroundColor = .systemRed
view.addSubview(separatorLine)
// Before 😕
let doingSomethingToOptionalView1: CGFloat? = {
guard let firstSubview = subviews.first else { return nil }
return (firstSubview.bounds.width / 2.0) + otherView.bounds.width
}()
// After 😊
let doingSomethingToOptionalView2 = subviews.first.useIfNotNil { ($0.bounds.width / 2.0) + otherView.bounds.width }
extension UIColor {
/// Blends this color into the specified color, as if this color was overlaid on top of the other at the specified alpha, but our result will instead be opaque. For instance if self was green, and we passed white and 0.1 alpha/opacity, the result would be a light, faded green.
///
/// - Note: This process is also called alpha compositing.
func blend(intoColor otherColor: UIColor, atOpacity alpha: CGFloat) -> UIColor {
let sourceRGB = rgb
let otherRGB = otherColor.rgb
return UIColor(
red: (sourceRGB.red * alpha) + (otherRGB.red * (1.0 - alpha)),
import SwiftUI
struct ContentView: View {
@State var show: Bool = false
var body: some View {
ZStack {
Button {
show.toggle()
} label: {
struct ContentView: View {
var body: some View {
Text(attributedString)
}
var attributedString: AttributedString {
var attributes = AttributeContainer()
let paragraphStyle = NSMutableParagraphStyle()
paragraphStyle.lineSpacing = 10.0

If I have a JSON Codable object in Swift that looks like:

struct IceCreamStore: Codable {
    let iceCreams: [IceCream: Int]
}

enum IceCream: String, Codable {
    case chocolate, vanilla
}