Skip to content

Instantly share code, notes, and snippets.

View akingdom's full-sized avatar

Andrew Kingdom akingdom

  • Australia
View GitHub Profile
@akingdom
akingdom / Useful Xcode debugger commands.md
Last active July 2, 2024 02:12
Useful Xcode debugger commands

Useful Xcode debugger commands

Command Description Example
Value Inspection
po Print the value of an expression po myVariable.count
po [object description] Print a detailed description of the object. po [myView debugDescription]
ptype Print the type of an expression ptype myArray
quick look Display a visual preview of an object in the debug pane
kvc path: "<key path>" Access nested properties using Key-Value Coding from the current context kvc path: "user.profile.name"
@akingdom
akingdom / macos-useful-commands.md
Last active August 8, 2024 07:20
Useful command-line (terminal) commands to use on MacOS

Command-line (MacOS)

On MacOS the command line is typically accessed via Terminal.app, equivalent to cmd.exe on Microsoft Windows. The Terminal app passesthe text commands to the operating system for processing, then displays the returned results or errors.

Killing processes on MacOS

In MacOS here are two ways to kill processes in one hit. I'll use Google Drive as an example.

List process IDs (optional, useful to query beforehand or verify afterwards):

ps aux | grep "Google Drive" | awk '{print $2}'

@akingdom
akingdom / 6-principles-of-a-programmable-system-AK.md
Last active August 8, 2024 06:58
Six Principles for Creating a Programmable System

Six Principles for Creating a Programmable System

By Andrew Kingdom

  1. User-Centric Design: The system should be designed with a core intent of assisting users to leverage their existing knowledge and experiences. This means the system should be intuitive and familiar, allowing users to apply what they already know to interact with and navigate the system effectively. Using familiar metaphors is one way to do this.

  2. Multi-Sensory Interactivity: Users should be able to create interactive elements that can be interacted with not only visually (e.g., through touch or gesture on a screen), but also through other senses. For example, users could create elements that respond to voice commands (auditory) or provide haptic feedback (tactile). This multi-sensory interactivity can enhance the user experience and make the system more accessible to a wider range of users.

  3. Inclusive Language and Symbolic Representations: The system should offer multiple modalities for instructions, including spoken

@akingdom
akingdom / colorConversion-simple.js
Last active November 22, 2024 08:08
Converts colours between web hex color and an RGBA object.
// Javascript
// Color from a web-style hex string -- for named colors, see https://gist.github.com/akingdom/0a0edd3ea37a9a331983cff3a69c4bee
// By Andrew Kingdom
// MIT license (use free and do not remove this author's name, etc)
//
// **Supported string formats**:
// - `"fff" // RGB`
// - `"#fff" // #RGB`
// - `"ffff" // RGBA`
// - `"#ffff" // #RGBA`

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 / 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.