Skip to content

Instantly share code, notes, and snippets.

View scottrhoyt's full-sized avatar

Scott Hoyt scottrhoyt

View GitHub Profile
@scottrhoyt
scottrhoyt / CFunctionReference.md
Last active October 21, 2025 22:59
An overview of GEOS geometry operations and how they handle dimensionality

GEOS C API Function Reference - Coordinate Dimension Handling

Complete reference for all geometric operations in the GEOS C API, with detailed information about how each function handles coordinate dimensions (XY, XYZ, XYM, XYZM).

Document Purpose

This reference answers the critical question: "What happens to my Z and M coordinates when I use this GEOS function?"

For each geometric operation in the C API, this document specifies:

  • Input dimension support
@scottrhoyt
scottrhoyt / ha-snooze-automation-button.yaml
Created December 4, 2022 02:53
Home Assistant: Snooze automation
blueprint:
name: Snooze Button
description: Snooze an automation for a time using and input boolean
domain: automation
input:
snooze_button:
name: Snooze Button
description: The input boolean to use as the snooze button
selector:
entity:
@scottrhoyt
scottrhoyt / HeapsAlgorithm.swift
Created September 20, 2017 00:57
Heap's Algorithm for permutations in Swift
// https://en.wikipedia.org/wiki/Heap%27s_algorithm
import Foundation
/**
Generates all possible permutations of `data` using Heap's Algorithm
- parameters:
- data: The data to permute
- output: A closure called with each permutation of the data
@scottrhoyt
scottrhoyt / JSONCodable+JSONObjects.swift
Last active March 27, 2021 00:19
A Swift 4 extension for JSONEncoder and JSONDecoder to enable serialization to/deserialization from JSON Objects (e.g. [String: Any])
import Foundation
extension JSONEncoder {
func encodeJSONObject<T: Encodable>(_ value: T, options opt: JSONSerialization.ReadingOptions = []) throws -> Any {
let data = try encode(value)
return try JSONSerialization.jsonObject(with: data, options: opt)
}
}
extension JSONDecoder {
@scottrhoyt
scottrhoyt / RandomGenerator.swift
Created September 1, 2015 21:55
This is a Swift 2.0 conversion of Erica Sadun's RandomGenerator from here: http://ericasadun.com/2015/04/24/swift-that-permutation-generator-thing/
/*:
**RandomGenerator.swift**
A Swift 2.0-compatible version of Erica Sadun's take on shuffling a
`CollectionType` available here:
http://ericasadun.com/2015/04/24/swift-that-permutation-generator-thing/.
*/
import Foundation