Skip to content

Instantly share code, notes, and snippets.

View romyilano's full-sized avatar
😎
improving

Romy romyilano

😎
improving
View GitHub Profile
@reduz
reduz / godot_vision_pro.md
Last active October 15, 2024 03:00
Godot on Vision Pro and similar devices

Vision Pro style API on Godot

Overview

Apple recently unveiled the Vision Pro. This type of device is mostly designed for augmented reality (AR), in the sense that it should be able to throw 3D models and rendering combined into a camera.

Normally with pass-through AR, one would expect to get the camera feed as an image and maybe some environment cubemap generated from the camera to apply proper lighting into the objects.

//
// CacheAsyncImage.swift
//
// Created by Costantino Pistagna on 08/02/23.
//
import SwiftUI
struct CacheAsyncImage<Content, Content2>: View where Content: View, Content2: View {
private let url: URL?
@CGArtPython
CGArtPython / reading_and_writing_json_files.py
Last active March 9, 2025 06:14
Reading and Writing JSON Files for Blender Python Beginners (tutorial video: https://youtu.be/f6UoW5rtrw0)
# extend Python's functionality to work with JSON files
import json
# extend Python's functionality to work with file paths
import pathlib
# extend Python's functionality to print data in a readable way
import pprint
# give Python access to Blender's functionality
@sebj
sebj / Guide.md
Last active April 8, 2025 18:04
Add a scene delegate back to a SwiftUI Project

Define an application delegate

See also: UIApplicationDelegate documentation

// AppDelegate.swift
@main
final class AppDelegate: NSObject, UIApplicationDelegate {

    func application(
        _ application: UIApplication,
@carlynorama
carlynorama / CollapsableView.swift
Last active July 16, 2022 18:32
A container that collapses.
//Based off of https://rensbr.eu/blog/swiftui-escaping-closures/
struct CollapsableView<Content: View>: View {
let content: Content
@Binding var isVisible:Bool
init(value:Binding<Bool>, @ViewBuilder content: () -> Content) {
self.content = content()
self._isVisible = value
}
@Amzd
Amzd / ColorPicker.swift
Last active January 25, 2025 08:49
What SwiftUI's ColorPicker should have been.
import SwiftUI
@available(iOS 14.0, *)
public struct ColorPickerWithoutLabel: UIViewRepresentable {
@Binding var selection: Color
var supportsAlpha: Bool = true
public init(selection: Binding<Color>, supportsAlpha: Bool = true) {
self._selection = selection
self.supportsAlpha = supportsAlpha
import SwiftUI
import WebKit
import Combine
class WebViewData: ObservableObject {
@Published var loading: Bool = false
@Published var scrollPercent: Float = 0
@Published var url: URL? = nil
@Published var urlBar: String = "https://nasa.gov"
@abhi21git
abhi21git / ExtensionURLRequest.swift
Last active April 8, 2025 10:51
Swift cURL Printer
//
// ExtensionURLRequest.swift
//
// Created by Abhishek Maurya on 16/07/20.
// Copyright © 2020. All rights reserved.
//
import Foundation
extension URLRequest {
final class _TextFieldCoordinator: NSObject {
var control: _TextField
init(_ control: _TextField) {
self.control = control
super.init()
control.textField.addTarget(self, action: #selector(textFieldEditingDidBegin(_:)), for: .editingDidBegin)
control.textField.addTarget(self, action: #selector(textFieldEditingDidEnd(_:)), for: .editingDidEnd)
control.textField.addTarget(self, action: #selector(textFieldEditingChanged(_:)), for: .editingChanged)
control.textField.addTarget(self, action: #selector(textFieldEditingDidEndOnExit(_:)), for: .editingDidEndOnExit)
@ruurdadema
ruurdadema / NetworkConnection.swift
Last active August 7, 2025 17:12
Swift networking with Apple's NWListener and NWConnection
/*
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the