Skip to content

Instantly share code, notes, and snippets.

@fabio914
fabio914 / levenshtein.swift
Created February 16, 2018 13:46
Levenshtein String Distance (Swift 4)
import Foundation
struct Matrix<T> {
let columns: Int
let rows: Int
private var matrix: [T]
init(columns: Int, rows: Int, repeating: T) {
self.columns = columns
@fabio914
fabio914 / Description.md
Created June 19, 2022 08:23
ARKit (iPhone/iPad) to Unity (Quest 2) calibration

This is how I get the current ARKit camera pose and send it to the Unity app (via a socket):

func sendPoseUpdate(with frame: ARFrame) {
    guard case .normal = frame.camera.trackingState else { return }

    let position = frame.camera.transform.columns.3

    let positionVector = Vector3(
        x: .init(position.x),
@fabio914
fabio914 / test-cursor-hover-css.md
Last active October 1, 2023 09:07
Different cursor when hovering

👋 this is how you can test this other cursor:

open Google Chrome, navigate to the website, then click on View > Developer > Inspect elements (or press ⌥⌘I). then under Elements, select the Styles tab in the right pane then click on the + button close to the Filter field

image1

and add the css below:

@fabio914
fabio914 / roundedCorners.swift
Created May 27, 2024 22:18
Command Line tool to add Rounded Corners to images
//
// This is a small command line tool for macOS that takes all images in a directory
// and creates versions of these images with rounded corners. Ideal for App Icons.
//
// Compile with:
// $ swiftc roundedCorners.swift
//
// Usage:
// ./roundedCorners imageDirectory
//
@fabio914
fabio914 / ParticlePhysicsApp.swift
Created September 15, 2024 20:04
Particle Physics Simulation app for the Apple Vision Pro (visionOS 2.0)
//
// ParticlePhysicsApp.swift
// ParticlePhysicsApp
//
// Created by Fabio Dela Antonio on 15/09/2024.
//
import SwiftUI
import RealityKit
import ARKit