This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Script to process .xcframework files and create new versions with specific configurations | |
# Usage: ./script_name.sh path_to_xcframeworks | |
set -e # Exit immediately if a command exits with a non-zero status | |
all_frameworks_path="$1" # The first argument is the path to the xcframeworks | |
# Change directory to the specified frameworks path | |
pushd "$all_frameworks_path" > /dev/null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
PDF Compressor using Ghostscript | |
This script allows the user to compress PDF files using Ghostscript. It provides | |
options to set the compression quality. | |
Requirements: | |
- Python 3.x | |
- Ghostscript installed on the system |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension CustomBox { | |
func addCollisions() { | |
guard let scene = self.scene else { | |
return | |
} | |
// Add the subscription for when this cube | |
collisionSubs.append(scene.subscribe(to: CollisionEvents.Began.self, on: self) { event in | |
// Get both CustomBox entities, if either entityA or entityB isn't a CustomBox | |
// then return becasue this is not the collision we're looking for | |
guard let boxA = event.entityA as? CustomBox, let boxB = event.entityB as? CustomBox else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CustomBox: Entity, HasModel, HasCollision, HasAnchoring { | |
/// Used to keeping a reference of any subscriptions involving this entity | |
var entitySubs: [Cancellable] = [] | |
required init(color: UIColor) { | |
super.init() | |
// Shape of this entity for any collisions including gestures | |
self.components[CollisionComponent] = CollisionComponent( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ARKit | |
extension ViewController { | |
func renderer(_ renderer: SCNSceneRenderer, didAdd node: SCNNode, for anchor: ARAnchor) { | |
guard let planeAnchor = anchor as? ARPlaneAnchor, let geom = ARSCNPlaneGeometry(device: MTLCreateSystemDefaultDevice()!) else { | |
return | |
} | |
geom.update(from: planeAnchor.geometry) | |
geom.firstMaterial?.colorBufferWriteMask = .alpha | |
node.geometry = geom |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
// Little trick for quickly getting the next power of 2 in swift | |
// Easier to understand, but slightly less optimised | |
func nextPow2(of val: Int) => Int { | |
return 1 << String(num - 1, radix: 2).count | |
} | |
// Found that the (marginally) faster way is to use bitwise OR | |
func optimised_nextPow2(of val: Int) => Int { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"log" | |
"math" | |
) | |
func Round(val float64) float64 { | |
return math.Floor(val + 0.5) |