Skip to content

Instantly share code, notes, and snippets.

View stoeckley's full-sized avatar

andrew stoeckley

  • Balcony Studio
  • Netherlands
View GitHub Profile
@stoeckley
stoeckley / xcode-vim.markdown
Created October 2, 2024 19:21 — forked from tkersey/xcode-vim.markdown
Notes for working with Xcode VIM mode

Xcode VIM

This document is a scratchpad for helping me learn commonly used actions in Xcode's VIM mode.

Commands are case-sensitive. A command of N means pressing shift + n on the keyboard.

[Formatting is a WIP]


Normal Mode Commands

Basic Navigation

@stoeckley
stoeckley / gist:7e0eb3b4c37b05365b154a404bc1d82d
Created July 12, 2024 20:17 — forked from rgcottrell/gist:5b876d9c5eea4c9e411c
An FM Synthesizer in Swift using AVAudioEngine
import AVFoundation
import Foundation
// The maximum number of audio buffers in flight. Setting to two allows one
// buffer to be played while the next is being written.
private let kInFlightAudioBuffers: Int = 2
// The number of audio samples per buffer. A lower value reduces latency for
// changes but requires more processing but increases the risk of being unable
// to fill the buffers in time. A setting of 1024 represents about 23ms of
@stoeckley
stoeckley / RGBtoHSV.swift
Created February 12, 2022 21:29 — forked from FredrikSjoberg/RGBtoHSV.swift
Color space conversion between RGB and HSV
// https://www.cs.rit.edu/~ncs/color/t_convert.html
struct RGB {
// Percent
let r: Float // [0,1]
let g: Float // [0,1]
let b: Float // [0,1]
static func hsv(r: Float, g: Float, b: Float) -> HSV {
let min = r < g ? (r < b ? r : b) : (g < b ? g : b)
let max = r > g ? (r > b ? r : b) : (g > b ? g : b)
@stoeckley
stoeckley / ConeTraceAnalytic.txt
Created December 14, 2021 12:57 — forked from sebbbi/ConeTraceAnalytic.txt
Cone trace analytic solution
Spherical cap cone analytic solution is a 1d problem, since the cone cap sphere slides along the ray. The intersection point to empty space sphere is always on the ray.
S : radius of cone cap sphere at t=1
r(d) : cone cap sphere radius at distance d
r(d) = d*S
p = distance of current SDF sample
SDF(p) = sdf function result at location p
x = distance after conservative step
@stoeckley
stoeckley / gist:1452ffceb62c3d8479810cd5edc36583
Created October 1, 2020 14:08 — forked from boredzo/gist:4604459
Two-color angle gradient in Core Image
kernel vec4 coreImageKernel(__color startColor, __color endColor)
{
vec2 point = destCoord();
float angle = atan(point.y, point.x) + radians(180.0);
//Start from the upper middle, not the left middle
angle += radians(90.0);
angle = mod(angle, radians(360.0));
float fraction = angle / radians(360.0);
@stoeckley
stoeckley / README.md
Created January 30, 2020 18:54 — forked from nikcub/README.md
Facebook PHP Source Code from August 2007
@stoeckley
stoeckley / gfx-tinykaboom.go
Created August 13, 2019 12:14 — forked from peterhellberg/gfx-tinykaboom.go
tinykaboom with gfx
package main
import (
"image"
"image/color"
"math"
"github.com/peterhellberg/gfx"
)
@stoeckley
stoeckley / raytracer.jl
Created November 29, 2018 23:58 — forked from IainNZ/raytracer.jl
Raytracer in Julia
const delta = sqrt(eps(Float64))
immutable Vec
x::Float64
y::Float64
z::Float64
end
+(a::Vec, b::Vec) = Vec(a.x+b.x, a.y+b.y, a.z+b.z)
-(a::Vec, b::Vec) = Vec(a.x-b.x, a.y-b.y, a.z-b.z)
*(a::Float64, b::Vec) = Vec(a*b.x, a*b.y, a*b.z)
@stoeckley
stoeckley / raytracer.nim
Created October 8, 2018 18:26 — forked from hcorion/raytracer.nim
A port of a raytracer, programmed in Nim, built by someone else, to sdl2
#Originally created by AdrianV and can be found here: https://gist.github.com/AdrianV/5774141
#Modified by me, hcorion to add sdl2 support and bring it up to speed with version 0.14.2 of Nim (nim-lang.org).
import math
import sequtils
import sdl2
import times
const
width = 1280