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
| def valid_date_type(arg_date_str): | |
| """custom argparse *date* type for user dates values given from the command line""" | |
| try: | |
| return datetime.datetime.strptime(arg_date_str, "%Y-%m-%d") | |
| except ValueError: | |
| msg = "Given Date ({0}) not valid! Expected format, YYYY-MM-DD!".format(arg_date_str) | |
| raise argparse.ArgumentTypeError(msg) | |
| def valid_datetime_type(arg_datetime_str): | |
| """custom argparse type for user datetime values given from the command line""" |
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
| /* Memoization Pattern */ | |
| // a single parameter example | |
| var myFunc = function ( param ) { | |
| if ( !myFunc.cache[ param ] ) { | |
| var result = {}; | |
| // ... expensive operation ... | |
| myFunc.cache[ param ] = result; | |
| } | |
| return myFunc.cache[ param ]; |
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
| /* this is the "root" in "root em." */ | |
| html { | |
| font-size: 62.5%; /* Now 10px = 1rem! */ | |
| } | |
| body { | |
| font-size: 16px; /* px fallback */ | |
| font-size: 1.6rem; /* default font-size for document */ | |
| line-height: 1.5; /* a nice line-height */ | |
| } |