Skip to content

Instantly share code, notes, and snippets.

View grahaml's full-sized avatar

Graham Losee grahaml

View GitHub Profile
@grahaml
grahaml / SketchSystems.spec
Last active October 23, 2018 17:43
Simple Form
Simple Form
Inactive*
focus field -> Field Active
Field Active
enter text -> Fields Filled
Fields Filled
submit -> Valid?
Valid?
yes -> Submit?
no -> Field Error
@grahaml
grahaml / SketchSystems.spec
Last active November 5, 2018 16:29
Single Auth Source
Single Auth Source
Credentials Form*
# This is an Input Field, described in submachine below
Email Field Active*
enter text -> Password Field Active
# This is an Input Field, described in submachine below
Password Field Active
enter text -> Credentials Filled
Credentials Filled
submit -> Valid?
@grahaml
grahaml / SketchSystems.spec
Last active October 23, 2018 17:13
Single Auth Source
Single Auth Source
Credentials Form*
# This is an Input Field, described in submachine below
Email Field Active
enter email -> Password Field Active
# This is an Input Field, described in submachine below
Password Field Active
enter password -> Credentials Filled
Credentials Filled
submit -> Valid?
@grahaml
grahaml / SketchSystems.spec
Last active October 23, 2018 17:42
Login Form
Login Form
Inactive *
focus email -> Email
focus password -> Password
Active
Email
focus password -> Password
Email Empty*
@grahaml
grahaml / roll_the_dice.py
Last active June 24, 2017 01:43
Roll the dice
import random
def roll(sides=6):
return random.randint(1, sides)
def main():
sides = 6
rolling = True
while rolling:
roll_again = input('Roll the dice? Yes = Enter, No = Q')
@grahaml
grahaml / car-calculator.js
Last active July 26, 2016 10:43
A couple of simple functions to calculate the total cost of buying a used car in Ontario (with ability to add a percentage based buffer)
const addTax = (price, tax) => price + (price * tax);
const addOntarioTax = (price) => addTax(price, 0.13);
const addLicensingCost = (price) => (price + 20 + 40 + 108);
const addBuffer = (price, buffer = 0) => (price + (price * buffer));
const calculateTotalCost = (price, buffer) => Math.round(addBuffer(addLicensingCost(addOntarioTax(price)), buffer));
module.exports = {
calculateTotalCost,
};
@grahaml
grahaml / .bash_profile
Last active August 29, 2015 14:07
My .bash_profile from the ol' office with a couple of neat things in it
# =======
# Aliases
# =======
alias ios='open /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app'
alias refresh='source ~/.bash_profile'
alias refreshhosts='dscacheutil -flushcache'
alias ipaddr="ifconfig | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p'"
alias copypath="pwd | pbcopy"
# =========================================