Skip to content

Instantly share code, notes, and snippets.

View hooman's full-sized avatar

Hooman Mehr hooman

  • Kirkland, WA, United States
  • X @h_mehr
View GitHub Profile
@hooman
hooman / hooman-guide.md
Last active June 12, 2026 19:22
The gist is kept for historical purposes. It is now expanded and can't fit flat files format of gist. The current version is here: https://github.com/hooman/hooman-method

The Hooman Method — Operating Guide

How to run the method. The reasoning, provenance, and references live in the companion: hooman-notes.md (same gist).

Status: Draft v0.7.4 (2026-06-04). v0.7.4 — renames overlays/ to aside/ and broadens it from repo-belonging symlink storage to a deliberate catch-all for workspace-scoped material without a better home (the symlink-storage role retained as one accepted kind), governed by a promotion rule and the kill criteria so it stays a waystation, not a graveyard. v0.7.3 — adds Post-implementation passes to the cycle-brief protocol: retrofittable concerns (formatting, lint, doc comments, naming, consistency) are factored out of the implementation pass into dedicated mechanical and semantic passes, the semantic (documentation) pass doubling as a lightweight correctness review. *v0.7.2 — adds the Global references section: some governing docs (the method itself, the design stances) are cross-project and live upstream, projected into each workspac

@hooman
hooman / CLA.md
Created February 27, 2026 00:28
CLA for IranTransitionProject contributors.

Contributor License Agreement

By signing this CLA, you agree that:

  1. You retain copyright over your contributions.
  2. You grant the Iran Transition Project a perpetual, worldwide, non-exclusive, royalty-free license to use, reproduce, modify, and sublicense your contributions as part of this project.
  3. You confirm your contribution is your original work and you have the right to grant this license.
@hooman
hooman / UnicodeScalarUtils.swift
Created March 15, 2019 00:44
Utilities to work with ASCII characters and characters as integers.
// A small set of utilities for working with Unicode and ASCII scalars. Here is what it does:
//
// 1. Make `UnicodeScalar` strideable. This enables ranges of Unicode Scalars such as "a"..."z".
// 2. Add strideable Unicode.ASCII.Scalar (type alias `ASCII`) to enable type-safe manipulation of ASCII bytes.
// 3. Define limited `+`/`-` operators for stridable types to make something like `"x" + ("A"-"a")` possible.
// 1. Make `UnicodeScalar` strideable. This enables ranges of Unicode Scalars such as "a"..."z".
// Constants used in `Strideable` conformance extension of `Unicode.Scalar`
@hooman
hooman / WeakReference.swift
Last active December 29, 2022 09:06
A set of utilities for working with weak references.
//: Playground - noun: a place where people can play
/// A protocol to provide an abstraction of types that hold a weak reference to a target object.
///
/// It is defined because a single generic implementation cannot support existentials, as they
/// do not conform to themselves or `AnyObject`. Most of its API is defined by protocol extensions
/// to makes it easier to create existential wrapper `struct`s or `final class`es.
///
/// Here is an example protocol and the corresponding weak reference
@hooman
hooman / TupleSplat.swift
Last active February 16, 2018 23:23
An operator for tuple splat of simple function arguments (up to six arguments implemented).
// An operator for tuple splat of simple function arguments (up to six arguments implemented).
// by Hooman Mehr (hooman@mac.com)
// Source released as public domain.
precedencegroup TupleSplatPrecedence {
associativity: left
higherThan: BitwiseShiftPrecedence
}
// Infix operator for on the fly tuple splat:
@hooman
hooman / HTMLBuilder.swift
Created April 10, 2017 03:20
This is a prototype code of a DSL to make it easier to generate HTML within Swift source code.
//
// HTMLBuilder.swift
//
// This is a prototype code of a DSL to make it easier to generate HTML within Swift source code.
//
// This version of the prototype usues global constants for html elements because of a compiler limitation / bug.
// The intended behavior was having these globals static properties of `Html` type.
//
// Created by Hooman Mehr on 04/07/17.
// Copyright © 2017 Hooman Mehr. See the MIT license at the bottom.
@hooman
hooman / Mutex.swift
Last active September 2, 2022 17:56
Swift 3.0 wrapper for the new os_unfair_lock
import Darwin
public protocol MutexValue {
mutating func lock()
mutating func locked() -> Bool
mutating func unlock()
@hooman
hooman / RationalNumber.swift
Last active January 26, 2021 15:40
Rational numbers in Swift 3.0
// RationalNumber.swift
//
// A basic implementation of Rational numbers in Swift 3.0.
// (c) 2016 Hooman Mehr. Licensed under Apache License v2.0 with Runtime Library Exception
/// A data type to model rational numbers in Swift.
///
/// It always uses fully-reduced representation for simplicity and clarity of comparisons and uses LCM
@hooman
hooman / CollectionIndexExtensions.swift
Last active May 11, 2016 15:31
Proposed additional index functions for Swift Collections.
//
// CollectionIndexExtensions.swift
// Swift3
//
// Created by Hooman Mehr on 5/9/16.
// Copyright © 2016 Hooman Mehr. See the MIT license at the bottom.
//
@hooman
hooman / KeyValueStore.swift
Last active April 30, 2016 01:46
An API for storing arbitrary key/value pairs. Supporting this API enables extensions to add their properties to our type.
//
// KeyValueStore.swift
// FoundationNG
//
// Created by Hooman Mehr on 4/27/16.
// Copyright © 2016 Hooman Mehr. See the MIT license at the bottom.
//