How to create a blockchain snapshot for a hardfork? I've done source forks (altcoins) and I understand how those work. But I'm a little stuck on how forks are activated? I need to know how blockchain snapshots are created and how the wallets know to distribute the initial fork offerings? If anyone could point me to a particular commit and/or PR of Bitcoin Cash or Gold where this logic is, I'd be very grateful.
Hard forks are simply extensions of a blockchain where the new blocks follow different consensus rules that are not compatible with the original blockchain. There is no actual snapshotting in a true hard fork. The hard fork software simply syncs up to a certain point with the original blockchain, and after that point, a new consensus rule is enforced which conflicts with the original chain and thus causes a blockchain fork. This is simply governed by an if statement in the block validation code.

The fork is simply activated by a miner who mines a block after a certain block or point in time that follows different consensus rules from the original chain.

For example, with Bitcoin Cash, their software enforced that the first block created after August 1st at 12:00 UTC must be larger than 1 MB and also follows the Bitcoin Cash consensus rules (larger block size, new signature hashing algorithm, etc.). This is encoded as an if statement in the block validation logic which checked the time of a block before executing different consensus rule checks. There is no actual snapshot that is taken; their blockchain up until that forking block is exactly identical to Bitcoin's and can be synced off a Bitcoin node.