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
| import logging | |
| import sys | |
| # Use this format for more verbosity | |
| LOGGING_FORMAT = "%(asctime)s - %(name)s - %(levelname)s - %(message)s" | |
| logger = logging.getLogger() | |
| logger.setLevel(logging.DEBUG) | |
| handler = logging.StreamHandler(stream=sys.stdout) |
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
| writing-mode: vertical-rl; | |
| text-orientation: upright; | |
| margin-left: auto; | |
| margin-right: auto; | |
| /* Add vertical-align: middle to <td> */ |
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
| function getObjectPaths(object, parentalPath="", delimiter=".") | |
| { | |
| let paths = []; | |
| for (const [key, value] of Object.entries(object)) | |
| { | |
| const pathComponents = []; | |
| // If 'parentalPath' doesn't indicate the root of the tree... | |
| if (parentalPath.length > 0) |
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
| function* enumerate(array) | |
| { | |
| /** | |
| * Duplicates the functionality of Python's enumerate function. | |
| * | |
| * Return, for each element of 'array' an array the element's index and the element. | |
| * | |
| * e.g. | |
| * | |
| * [i, elem] |
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
| git+ssh://git@github.com/user/repo.git@branch |
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
| vertical-align: top; | |
| display: inline-block; | |
| position: relative; | |
| top: 50%; | |
| transform: translateY(-50%); |
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
| { | |
| "client_secrets": { | |
| "web": { | |
| "auth_uri": "<Retrieve from IBMid registration>", | |
| "client_id": "<your_client_id>", | |
| "client_secret": "<your_client_secret>", | |
| "token_uri": "<Retrieve from IBMid registration>", | |
| "token_introspection_uri": "<Retrieve from IBMid registration>", | |
| "issuer": "<Retrieve from IBMid registration>" | |
| } |
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
| class ColorCycler | |
| { | |
| /** | |
| * A class that will return a CSS-valid "hsl()" string, assigned to distinct items. | |
| * | |
| * An internal mapping of "items" (any valid Object key) to "hsl()" strings. | |
| * If a color is requested for an existing item, the existing color is returned. | |
| * If a color is requested for a non-existing item, a new color is generated, stored for future use and returned. | |
| * | |
| * When a new color is generated the "hue" value is rotated (0 - 360). |
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
| class DefaultList(list): | |
| def __init__(self, iterable=[], default=None): | |
| super(self.__class__, self).__init__(iterable) | |
| self.default = default | |
| def __getitem__(self, index): | |
| """ | |
| If 'index' is outside of the bounds (including negative indexing) of the list, | |
| return 'self.default.' |
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
| class TemporaryDirectory(object): | |
| """ | |
| Produces a temporary directory on the system using tempfile.mkdtemp() under the hood. | |
| Exposes a path attribute that will represent the path of the directory | |
| until the instance has deleted the temporary directory. | |
| TemporaryDirectory can be used as a context manager. | |
| """ |