If you use atom... download & install the following packages:
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
# Since Safari 13 the Wikiwand plugin is no longer available and they | |
# don't even list Safari as a supported browser anymore. | |
# | |
# Most people use some kind of ad blocker, and personally I'm using "AdGuard for Safari" which allows you | |
# to define filters that inject javascript code on certain domains. | |
# | |
# Simply add this to AdGuards "User filter", and any wikipedia article will be redirected to Wikiwand. | |
# | |
@@||wikipedia.org^$generichide,badfilter |
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
# NOTE This is probably no longer needed, now DRF does this | |
# automatically if you have ATOMIC_REQUESTS enabled. | |
# https://github.com/encode/django-rest-framework/pull/2887 | |
from django.db import transaction | |
class AtomicMixin(object): | |
""" | |
Ensures we rollback db transactions on exceptions. |
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
# turn dict into an object that allows access to nested keys via dot notation | |
# from http://stackoverflow.com/questions/3797957/python-easily-access-deeply-nested-dict-get-and-set | |
# made three modifications: | |
# --added `get()` method | |
# --added `if not dict.__contains__...` to `__contains__()` | |
# --can now accept None as key | |
class dotdictify(dict): | |
def __init__(self, value=None): | |
if value is None: | |
pass |
Groupon US' recognized holidays are:
- New Year’s Day
- Memorial Day
- Independence Day
- Labor Day
- Thanksgiving Day
- day after Thanksgiving
- day before Christmas
- Christmas Day
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
""" | |
module mydjangolib.bigint_patch | |
A fix for the rather well-known ticket #399 in the django project. | |
Create and link to auto-incrementing primary keys of type bigint without | |
having to reload the model instance after saving it to get the ID set in | |
the instance. | |
Logs: |
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
''' | |
given a Model with: | |
category = models.CharField(max_length=32, choices=CATEGORY_CHOICES) | |
pubdate = models.DateTimeField(default=datetime.now) | |
<other fields> | |
Fetch the item from each category with the latest pubdate. | |
''' |