Skip to content

Instantly share code, notes, and snippets.

@edgerunner
Last active October 21, 2019 11:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save edgerunner/d5c5b7f8697b1f2d889460b5f61dbc48 to your computer and use it in GitHub Desktop.
Save edgerunner/d5c5b7f8697b1f2d889460b5f61dbc48 to your computer and use it in GitHub Desktop.
SmartTime keyboard 3
SmartTime keyboard 3
# entering the first digit of the hour
digit-1
# assume 00:00
ENTER -> complete
# first digit can be 0,1 or 2
KEY 0-1 -> digit-2
# 2 is the special case because it can only continue with 0-3
KEY 2 -> 2
# otherwise assume it's a single-digit hour, jump to minutes
KEY 3-9 -> digit-3
# entering the second digit of the hour
digit-2
# end with a single-digit hour value (0h:00)
ENTER -> complete
# 0 or 1, can go to anything between 00-19
default
# complete the hour and ask for the minute
KEY 0-9 -> digit-3
# 2 is the special case because it can only continue with 0-3
2
# this is really an hour in the 20-23 range, go and enter minutes
KEY 0-3 -> digit-3
# this is probably something between 02:40 and 02:59
KEY 4-5 -> digit-4
# 26-29 is pointless. warn the user
KEY 6-9 -> warning
# nothing wrong
ready
# the number isn't right
warning
# high digit of the minute
digit-3
# skip minutes, end with hh:00
ENTER -> complete
# legitimate first digit of the minute, proceed to the last one
KEY 0-5 -> digit-4
# this can't be a high minute digit, assume and complete with hh:0m
KEY 6-9 -> complete
# low minute digit, can be anything
digit-4
# assume the low digit is 0 and end with hh:m0
ENTER -> complete
# finalise the last digit and end with hh:mm
KEY 0-9 -> complete
complete
function render(model){
let states = model.active_states.map(s => `${s.parent.name} ${s.name}`);
return states.map(s => <h1>{s}</h1>);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment