Skip to content

Instantly share code, notes, and snippets.

View marcelvanworkum's full-sized avatar
🏠
Working from home

Marcel van Workum marcelvanworkum

🏠
Working from home
View GitHub Profile
@marcelvanworkum
marcelvanworkum / combinations.py
Created April 1, 2022 22:41
Compute combinations
import sys
def combinationsNoOrder(a, n):
if n == 1:
for x in a:
yield [x]
else:
for i in range(len(a)):
for x in combinationsNoOrder(a[:i], n-1):
yield [a[i]] + x
@marcelvanworkum
marcelvanworkum / SCNNode+Text.swift
Last active December 21, 2021 15:21
SCNNode extension to create a centred SCNText above another node, optionally with a LookAt constraint toward another node.
import SceneKit
extension SCNNode {
static func text(
withString string: String,
color: UIColor,
fontSize: Float = 0.1,
shouldLookAtNode lookAtNode: SCNNode? = nil,
addAboveExistingNode existingNode: SCNNode? = nil) -> SCNNode {