Skip to content

Instantly share code, notes, and snippets.

New Mac Setup yay!

Peter Witham GrfxGuru

New Mac Setup yay!
View GitHub Profile
GrfxGuru /
Last active Oct 31, 2021
My bootstrap for setting up a new macOS machine
#!/usr/bin/env bash
# Bootstrap script for setting up a macOS machine
echo "Remember to install Xcode from the Store first"
echo "Starting bootstrapping"
GrfxGuru / SceneAutoLoader.cs
Created Jan 2, 2019
Unity 3D Script to specify which scene is loaded when playing in the editor
View SceneAutoLoader.cs
using UnityEngine;
using UnityEditor;
using UnityEditor.SceneManagement;
/// <summary>
/// Scene auto loader.
/// </summary>
/// <description>
/// This class adds a File > Scene Autoload menu containing options to select
/// a "master scene" enable it to be auto-loaded when the user presses play
GrfxGuru / code.swift
Created Mar 11, 2017
Example of using Guard to exit early with readable code
View code.swift
func nameOnTheList(name: String) {
guard name == "Peter" else {
print("Not getting in!")
print("Come on in!")
nameOnTheList(name: "Peter")
nameOnTheList(name: "Ken")
GrfxGuru / code.swift
Created Mar 11, 2017
Swift Convenience Initializers
View code.swift
class Human {
var arms: Int
var legs: Int
var ears: Int
init(arms: Int, legs: Int, ears: Int) {
self.arms = arms
self.legs = legs
self.ears = ears
View gist:455c3bd8935227996da8597e19d50098
defaults write location ~/ <some location>
killall SystemUIServer
GrfxGuru / swift_optional
Last active Aug 29, 2015
Simple Swift optional example both long and short version.
View swift_optional
let numberOfWheels = [“car”: 4, “bike”: 1, "legs" : 0]
let wheelCount: Int? = numberOfWheels[“unicycle”]
// Now to unwrap wheelCount, if wheelCount is nil then
// the if block is never executed
// Long way
if wheelCount == nil {
println(“unicycle wasn’t found”)