Skip to content

Instantly share code, notes, and snippets.

View billbonney's full-sized avatar

Bill Bonney billbonney

  • Communis Tech Inc
View GitHub Profile
@billbonney
billbonney / .zshrc
Last active October 26, 2024 04:27
Simple Simon .zshrc (The one that does it all with very little!)
#
# Simple Simon .zshrc
#
# This simple enough in that it adds all that is needed, without external dependencies
# - Command Completion
# - Reverse/Forware searching using up/down arrows
# - VCS supports (git focus) - shows branch name and status.
#
export HISTFILE="$HOME/.zhistory" # History filepath
export HISTSIZE=10000 # Maximum events for internal history
@billbonney
billbonney / .vimrc
Last active March 5, 2025 08:37
.vimrc
" NOTE: Install Plug to autoload 1st.
" curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
" Load Plugins using Plug
"
call plug#begin()
" Xcode Color Themes
Plug 'lunacookies/vim-colors-xcode'
Plug 'morhetz/gruvbox'
@billbonney
billbonney / pre-commit
Created August 24, 2021 20:23
swift-format git pre-commit hook
#!/bin/bash
if which swift-format >/dev/null; then
git diff --diff-filter=d --staged --name-only | grep -e '\(.*\).swift$' | while read line; do
swift-format -m format -i "${line}";
git add "$line";
done
exit 0
else
echo "warning: swift-format not installed"
@billbonney
billbonney / .gitconfig
Last active October 22, 2024 07:59
gitconfig shortcuts and default settings
#
# .gitconfig with simple shortcuts for common actions
#
[user]
name = <your.name>
email = <your.email>
[alias]
br = branch
ci = commit
@billbonney
billbonney / ColorPicker.swift
Last active April 3, 2018 02:13
Simple Color Picker UIView for iOS
//
// Copyright (c) 2018 Bill Bonney <[email protected]>. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
@billbonney
billbonney / android_dev_studio.xml
Created March 18, 2015 05:27
Android Dev Studio Theme for Qt Creator
<?xml version="1.0" encoding="UTF-8"?>
<style-scheme version="1.0" name="Android Dev Studio">
<style name="Text" foreground="#a8b7c7" background="#2b2b2b"/>
<style name="Link" foreground="#009dff"/>
<style name="Selection" foreground="#000000" background="#a8b7c7"/>
<style name="LineNumber" foreground="#888888" background="#232323"/>
<style name="SearchResult" background="#555500"/>
<style name="SearchScope" background="#222200"/>
<style name="Parentheses" foreground="#f1d031" background="#0f5903" italic="true"/>
<style name="CurrentLine" background="#054100"/>
@billbonney
billbonney / fix_master_branch.md
Last active November 9, 2021 23:24
How to fix master when it diverges using git

If your master branch of your fork has diverged from upstream master you can check your master by typing

git checkout master
git fetch upstream master
git merge --ff-only upstream/master # if this fails your master is not the same as upstream i.e. it won't fast-forward

To clean up your master try (Option 2 is simpler, Option 1 downloads less)

# (Option 1) Fix master from point of divergence
#WARNING: you will lose your changes to master
@billbonney
billbonney / ASwiftTour.playground.swift
Last active June 5, 2025 01:57
A Swift Tour - The Swift Programming Language - Solutions
//
// Copyright © 2023 Bill Bonney. All rights reserved.
//
// The Swift Programming Language: Swift by Tutorials (solutions)
// Author: Bill Bonney <billbonney (at) communistech.com>
//
// This is all the code in The Swift Tour section in the Apple Book on Swift.
// This should allow you to play with the code and see behaviours, and help
// solve any paticulars you get stuck on when doing the Experiments.
//