This file contains 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
#Print a line to the console in red text: | |
print(f'\033[31mThis is red text\033[0m') | |
#Print a line to the console in green text: | |
print(f'\033[32mThis is green text\033[0m') | |
#Print a line to the console in yellow text: | |
print(f'\033[33mThis is yellow text\033[0m') | |
#Print a line to the console in blue text: |
This file contains 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
def slugFinder(urlString): | |
""" | |
Finds and returns the slug from a given URL string. | |
A slug is typically the last segment of a URL after the last '/'. | |
This function handles the following cases: | |
- If the URL ends with a trailing slash, it returns the segment before the slash. | |
- If the URL does not end with a trailing slash, it returns the last segment. | |
- If the last segment is the top-level domain (TLD), it returns '/' to indicate the root. |
This file contains 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
"For Items Loop": { | |
"prefix": "for items", | |
"body": [ | |
"for items in ${TM_SELECTED_TEXT:$1}:", | |
" print(f'${TM_SELECTED_TEXT:$1} Item: {items}')" | |
], | |
"description": "For Items Loop" | |
} |