Skip to content

Instantly share code, notes, and snippets.

View bigonese's full-sized avatar

Eric Bigoness bigonese

View GitHub Profile
@bigonese
bigonese / example.php
Last active October 22, 2019 13:51
Example of how a "test mode" can be incorporated into a class (eg, a class that interacts with a database) so that it can be unit tested as much as possible.
<?php
// Used to make sure test mode isn't entered into on accident
class TestModeException extends Exception { }
// Used to return a testable value as far into the logic that the test can reach
class TestResultsException extends Exception { }
// The class which will be tested
class TestableClass {
@bigonese
bigonese / vpn.sh
Created January 11, 2017 13:06
Script to start sstp-client on a Mac, connecting to Microsoft VPN, with ability to use Apple's KeyChain
#!/bin/bash
SERVICE_NAME='my-example-vpn'
SERVICE_URL='my-example-vpn.com'
if [[ ${#USER} > 1 ]]
then
read -p "Log in as ${USER}? [y/n] " LIA
else
LIA = 'n'
@bigonese
bigonese / gifting.rb
Last active November 22, 2017 20:03
Drawing names for Christmas gifts
kids = [
# Name, Family
['Noah', :esb],
['Galen', :esb],
['Charlotte', :kab],
['Alice', :kab],
['Elijah', :dkw],
['Celia', :dkw],
['Helena', :dkw]
]