Skip to content

Instantly share code, notes, and snippets.

@snowzurfer
snowzurfer / HTTPURLResponse+Extensions.swift
Created March 7, 2023 06:08
Check if a `HTTPURLResponse`'s `statusCode` is a 2xx
extension HTTPURLResponse {
/// Returns `true` if `statusCode` is in range 200...299.
/// Otherwise `false`.
var is2xx: Bool {
return 200 ... 299 ~= statusCode
}
}
@snowzurfer
snowzurfer / SwiftUI_LikeButton_Increments.swift
Last active February 26, 2023 06:44
SwiftUI ❤️ like ❤️ button with animated increments
import SwiftUI
struct LikeButton: View {
@State private var likesCount = 0
@State private var tappedLike = false
var body: some View {
Button {
tappedLike = false
likesCount += 1
@snowzurfer
snowzurfer / LazyImageWithLoadingStates.swift
Created January 30, 2023 05:15
SwiftUI animated Skeleton Image and demo usage with NukeUI Image.
//
// LazyImageWithLoadingStates.swift
//
// Copyright © 2023 Alberto Taiuti. All rights reserved.
//
import os
import NukeUI
import SwiftUI
import SFSafeSymbols
@snowzurfer
snowzurfer / 3DPointsFromDepth.swift
Last active July 12, 2024 07:39
3D world points from ARKit depth
import ARKit
import SceneKit
let horizontalPoints = 256 / 2
let verticalPoints = 192 / 2
var depthNodes = [SCNNode]()
var parentDebugNodes = SCNNode()
var sceneView: ARSCNView!
// Somewhere during setup
@snowzurfer
snowzurfer / gpu_arch_resources
Last active March 6, 2017 10:34 — forked from jhaberstro/gpu_arch_resources
GPU Architecture Learning Resources
http://courses.cms.caltech.edu/cs179/
http://www.amd.com/Documents/GCN_Architecture_whitepaper.pdf
https://community.arm.com/graphics/b/blog
http://cdn.imgtec.com/sdk-documentation/PowerVR+Hardware.Architecture+Overview+for+Developers.pdf
http://cdn.imgtec.com/sdk-documentation/PowerVR+Series5.Architecture+Guide+for+Developers.pdf
https://www.imgtec.com/blog/a-look-at-the-powervr-graphics-architecture-tile-based-rendering/
https://www.imgtec.com/blog/the-dr-in-tbdr-deferred-rendering-in-rogue/
http://developer.amd.com/tools-and-sdks/opencl-zone/amd-accelerated-parallel-processing-app-sdk/opencl-optimization-guide/#50401334_pgfId-412605
https://fgiesen.wordpress.com/2011/07/09/a-trip-through-the-graphics-pipeline-2011-index/
https://community.arm.com/graphics/b/documents/posts/moving-mobile-graphics#siggraph2015