This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python | |
| # A simple Python application for controlling a relay board from a Raspberry Pi | |
| # The application uses the GPIO Zero library (https://gpiozero.readthedocs.io/en/stable/) | |
| # The relay is connected to one of the Pi's GPIO ports, then is defined as an Output device | |
| # in GPIO Zero: https://gpiozero.readthedocs.io/en/stable/api_output.html#outputdevice | |
| import sys | |
| import time |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var validArgs = ['some_command', 'another_command']; | |
| //================================================================= | |
| //First lets sort out the command line arguments | |
| //================================================================= | |
| var userArgs; | |
| //Is the first item 'node'? then we're testing | |
| if (process.argv[0].toLowerCase() == 'node') { | |
| //whack the first two items off of the list of arguments | |
| //This removes the node entry as well as the module name entry (the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| window.onerror = function (msg, url, line) { | |
| var idx = url.lastIndexOf("/"); | |
| if (idx > -1) { | |
| url = url.substring(idx + 1); | |
| } | |
| //Build the message string we'll display to the user | |
| var errStr = "ERROR in " + url + " (line #" + line + "): " + msg; | |
| //Write the error to the console | |
| console.error(errStr); | |
| //Tell the user what happened |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Override | |
| public boolean onCreateOptionsMenu(Menu menu) { | |
| getMenuInflater().inflate(R.menu.app_menu, menu); | |
| //Only display the menu if the app is in Override mode | |
| if (mIsOverride) { | |
| //First add the click listener for the menu item | |
| MenuItem mItem = menu.findItem(R.id.menu_item_one_time_code); | |
| mItem.setOnMenuItemClickListener( | |
| new MenuItem.OnMenuItemClickListener() { | |
| @Override |
NewerOlder