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 remove_empty_fields(data_): | |
""" | |
Recursively remove all empty fields from a nested | |
dict structure. Note, a non-empty field could turn | |
into an empty one after its children deleted. | |
E.g, | |
{ | |
"location": { |
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
/* | |
* Authenticate Django users in node.js. | |
* | |
* Django is great for many projects, while node.js does some fantastic | |
* jobs that Django couldn't. For example, you may have a Django app | |
* managing your user accounts and another real-time service or application | |
* running on Node, then you probably will need to read Django user session | |
* to authenticate users in the Node project. | |
* | |
* This gist is not production ready yet, but it demonstrates how could it |
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
URL_REGEX = re.compile(r"^(http|https)://.+$") | |
IP_ADDRESS_V4_REGEX = re.compile(r"^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}" | |
r"(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$") | |
US_ZIP_REGEX = re.compile(r"\d{5}(\-\d{4})?$") | |
UK_ZIP_REGEX = re.compile(r"^((GIR ?0AA)|((([A-PR-UWYZ][A-HK-Y]?[0-9][0-9]?)" | |
r"|(([A-PR-UWYZ][0-9][A-HJKSTUW])" | |
r"|([A-PR-UWYZ][A-HK-Y][0-9][ABEHMNPRV-Y]))) ?" |