Skip to content

Instantly share code, notes, and snippets.

View sstoops's full-sized avatar

Sean Stoops sstoops

View GitHub Profile
count date
9 2010-01-01 00:00:00-08
102 2010-01-02 00:00:00-08
132 2010-01-03 00:00:00-08
62 2010-01-04 00:00:00-08
74 2010-01-05 00:00:00-08
82 2010-01-06 00:00:00-08
111 2010-01-07 00:00:00-08
95 2010-01-08 00:00:00-08
111 2010-01-09 00:00:00-08
// This code attaches a GTM event to the successful submission of a MailChimp
// popup form. This code is designed to be deployed inside the same <script>
// tag you use to install the MailChimp popup form.
// The basic gist of this code is this:
// 1) Wait for the MailChimp Iframe to come into existence
// 2) Attach a submit event listener to the form
// 3) Since we don't know if a submit will be successful, we have grab all
// the data that was in the form, then start an interval to check for
// the existence of a "success" screen.
# fmt: black
"""Transfer an object and its reverse-dependants from one database to another.
This script is useful for "undeleting" objects. Let's say a user with the username of
robc was mistakenly deleted in the Django admin (or by a query like obj.delete()) and
all reverse-related objects were deleted along with it. This may include all photos
since Photo.photographer is a FK to User, then on to stories since Story.teaser_photo
is a FK to Photo. As you can imagine, leading to quite the catastrophy.
If you can get your hands on a copy of the database before the deletion occurred, load