Skip to content

Instantly share code, notes, and snippets.

View waylonis's full-sized avatar
💭
Working for the man

Daniel Waylonis waylonis

💭
Working for the man
View GitHub Profile
@klein-artur
klein-artur / Selectables.swift
Created July 8, 2023 00:13
SwiftUI Selectable List
struct Selectables<Data, ID: Hashable, Content>: View where Content: View {
let data: [Data]
@Binding var selectedIds: [ID]
let id: KeyPath<Data, ID>
let content: (Data, Binding<Bool>) -> Content
init(_ data: [Data], selectedIds: Binding<[ID]>, id: KeyPath<Data, ID>, @ViewBuilder content: @escaping (Data, Binding<Bool>) -> Content) {
self.data = data
self._selectedIds = selectedIds
self.id = id
@kieber-emmons
kieber-emmons / ParallelRadixSort.metal
Last active February 6, 2024 10:24
This gist is for an article I wrote on Medium (https://medium.com/p/4f4590cfd5d3).
//
// ParallelRadixSort.metal
//
// Created by Matthew Kieber-Emmons on 08/29/22.
// Copyright © 2022 Matthew Kieber-Emmons. All rights reserved.
// This work is for educational purposes only and cannot be used without consent.
//
#include <metal_stdlib>
using namespace metal;
@mhuusko5
mhuusko5 / Swift – func deepDescription
Last active November 3, 2022 16:26
Swift – func deepDescription(any: Any) -> String (pretty print any object, recursively)
func deepDescription(any: Any) -> String {
guard let any = deepUnwrap(any) else {
return "nil"
}
if any is Void {
return "Void"
}
if let int = any as? Int {