Skip to content

Instantly share code, notes, and snippets.

View akingdom's full-sized avatar

Andrew Kingdom akingdom

  • Australia
View GitHub Profile
@akingdom
akingdom / pathGetter.js
Created August 8, 2025 15:04
High-performance, hybrid property accessor for dot-delimited paths.
// pathGetter.js - MIT License (C) 2025 Andrew Kingdom
/**
* createPathGetter
* ----------------
* Returns a high-performance, hybrid property accessor for dot-delimited paths.
*
* DESIGN:
* - Cold paths (below `threshold` calls) use a manual string parse to avoid `.split()` allocations.
* - Hot paths (≥ `threshold` calls) are promoted to precompiled accessors and cached for speed.
* - Cache is capped (`maxCacheSize`) and evicts oldest hot paths (FIFO) to control memory growth.

BBEdit Grep Patterns

Author: Andrew Kingdom Note: These are grep patterns I find useful for the BBEdit text editor on MacOS. Some templates may need modification/changes before use on your specific data.

  • Remove Blank Lines

    • Find: ^\s*$\n
    • Replace: (empty string)
  • Pascal Comment to C Comment

  • Find: {([^}]*)}

@akingdom
akingdom / Source Control in a nutshell.md
Last active March 14, 2025 06:38
What is Source Control? A quick glossary for non-technical people.

Source Control - what is it

Term Definition
Source A written recipe (programming code) and ingredients (data resources) from which an app is built.
Version Source Control A way to keep track of all the changes you make and easily go back to any previous version if you make a mistake.
Git A version source control system that distributes a full copy to each developer. Originally created to manage the Linux project.
GitHub One commercial provider of a Git service. Backed by Microsoft.
Repository Storage for all the different versions of your project's files.
@akingdom
akingdom / PLY file format + notes.md
Last active March 14, 2025 06:37
This document presents the PLY polygon file format, a format for storing graphical objects that are described as a collection of polygons.
@akingdom
akingdom / ReadDataLines.swift
Last active March 14, 2025 06:36
Process lines in a simple memory-resident ASCII-style string in UTF8 format.
// Swift
//
// Intent: Process a simple memory-resident ASCII-style string in UTF8 format.
//
// Reads Data as a string, line by line,
// similar to how FileHandle works with a file pointer index.
// There are better ways to do this.
//
// By Andrew Kingdom
// MIT license
@akingdom
akingdom / printerror.js
Last active March 14, 2025 06:35
Example of printing a source code line at an error position (based on an index within the entire source code)
// Example of printing a source code line at an error position
// (based on an index within the entire source code)
//
// By Andrew Kingdom
// MIT license
// (and use at own risk)
//
// Example prints:
//
// DEFGH
@akingdom
akingdom / Xcode-add-Sandbox-Capability.md
Last active March 14, 2025 06:35
Add the App Sandbox capability to an Xcode project when it is missing from the standard capabilities area.

Add the App Sandbox capability to an Xcode project when it is missing from the standard capabilities area.

(Straightforward to do but a pain to remember.)

  1. If your project lacks a .entitlements file, create a new one:
  • Menu: View > Navigators > Project
  • Select the root level (project icon) of your project
  • Menu: File > New > File...
  • Use the Property List template
@akingdom
akingdom / is_Android_app_debuggable.java
Last active March 14, 2025 06:34
check if the Android app is a debug build versus a release build
// Android Java
// How to check if the app is a debug build versus a release build.
//
// By Andrew Kingdom
// MIT license
//
public class MainActivity extends AppCompatActivity {
// Returns true if the app is debuggable
@akingdom
akingdom / Useful-Excel-Formulas.txt
Last active March 14, 2025 06:34
Useful Excel Formulas
Useful Excel Spreadsheet Formulas
---------------------------------
By Andrew Kingdom
MIT license
Shows the number of weeks covering two dates. This works across year boundaries. This is not the same as the number of weeks between two dates.
[B7] 2022-11-23 Date 1
[B8] 2023-01-15 Date 2
[B9] =ROUNDUP(((B8-WEEKDAY(B8,1)+7)-(B7-WEEKDAY(B7,1)+1))/7,0)
@akingdom
akingdom / AssetImportRenamer.cs
Last active February 25, 2025 17:15
Maintains a renamed copy of certain Unity Resources asset files in your project. For example, by default Unity won't include SVG files as text XML for further processing.
// Maintains a renamed copy of certain Unity Resources asset files in your project.
// E.g. by default Unity won't include SVG files as XML for further processing.
//
// Put this file in the Assets/Editor folder.
//
// This script automatically rename resource files with a .txt (text) or .bytes (binary) extension,
// to be readable as Resources.Load<TextAssets>(path).text or Resources.Load(path) as byte[].
//
//
// License: CC0