Just copy and paste HTML code to your project. You have the {pan} variable in global scope and {setProgress} function to set the current progress. Unminified version http://goo.gl/sq2gDY
A Pen by Lego Mushroom on CodePen.
""" | |
Patches the database wrapper and template engine to throw an exception if a query is executed inside of a template. | |
In your urls.py, enable it like so: | |
>>> import monkey | |
>>> monkey.patch_templates() | |
""" | |
import logging |
def do_sometag(parser, token): | |
""" | |
{% tagname arg1 arg2 arg3 ... with kwg1=v kwg2=v kwg3=v ... as varname %} | |
""" | |
argv = token.contents.split() | |
# get the index of 'as' or the total length of the arguments | |
a = 'as' in argv and argv.index('as') or len(argv) | |
# get the index from 'with' to 'as' or the total length of arguments |
import time, logging | |
class debug_watch: | |
def __init__(self, name, logger=logging.info): | |
self.name = name | |
self.logger = logger | |
def __enter__(self): | |
self.t = time.time() | |
self.logger("Starting %s" % self.name) |
# Helps to see status messages when developing. | |
#require 'arachni/ui/cli/output' | |
# Only works with the latest code from the experimental branch. | |
require 'arachni' | |
# to avoid having to prefix every object's name with it | |
include Arachni | |
include Utilities |
from django.db.models.query import QuerySet | |
from django.db import models | |
class QuerySetManager(QuerySet): | |
''' | |
Subclass this class to define custom Managers with chainable, custom | |
QuerySet calls. | |
For example, define your queryset subclassing this object: |
/** | |
* X-Editable Radiolist extension for Bootstrap 3 | |
* @requires X-Editable, jquery, etc. | |
* @example: | |
$('.editable-earn-method').editable({ | |
name: 'earn_method', | |
source: [ | |
{value: 'swipes', text: 'Number of swipes'}, | |
{value: 'spend', text: 'Spend Amount ($USD)'} |
Just copy and paste HTML code to your project. You have the {pan} variable in global scope and {setProgress} function to set the current progress. Unminified version http://goo.gl/sq2gDY
A Pen by Lego Mushroom on CodePen.
# -*- coding: utf-8 -*- | |
from django.db.models import Model | |
from django.contrib.contenttypes.fields import GenericForeignKey | |
from django.db.utils import IntegrityError | |
from django.db import transaction | |
from urllib import parse | |
try: | |
from django.apps import apps |
class QuerySetDoubleIteration(Exception): | |
"A QuerySet was iterated over twice, you probably want to list() it." | |
pass | |
# "Skinny" here means we use iterator by default, rather than | |
# ballooning in memory. | |
class SkinnyManager(Manager): | |
def get_query_set(self): | |
return SkinnyQuerySet(self.model, using=self._db) |
""" | |
Decrease the verbosity of writing view tests. | |
Old way: | |
self.client.get(reverse("my-view")) | |
self.client.post(reverse("my-view"), data={"key": "value"}) | |
self.client.login("username", "password") | |
self.client.get(reverse("my-other-view")) | |
self.client.logout() |