Skip to content

Instantly share code, notes, and snippets.

View akingdom's full-sized avatar

Andrew Kingdom akingdom

  • Australia
View GitHub Profile
@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`
@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 / Programming-Advice-AK.md
Last active August 24, 2024 14:53
A general discussion on programming, including my comments to students.
@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 / 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"

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 / ReadLine.swift
Last active September 28, 2023 19:27
Read a single line string from a file
// Swift
//
// Intent: Read a single line string from a file, with some memory efficiency.
// This could be improved by use of an (unsafe) memory buffer
//
// By Andrew Kingdom
// MIT license
//
class ReadLineTool {
// 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 / concertina-collapsible.js
Last active September 19, 2023 08:39
This is an example of implementing headings with collapsible content. This doesn't currently recalculate height if content changes as I don't need that.
// Implements clickable headings with collapsible content.
// This doesn't currently recalculate height if content changes as I don't need that.
//
// Copyright (C) Andrew Kingdom 2023. all rights reserved.
//
// Heading elements must include class 'heading'.
// Content elements must include class 'collapsibleContent' and be the node sibling immediately after the Headiing.
//
//
// If HTML is in a separate file,