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
""" | |
Emoticon Extension for python-markdown | |
====================================== | |
Converts defined emoticon symbols to images, with the symbols as their ``alt`` | |
text. Requires python-markdown 1.6+. | |
Basic usage: | |
>>> import markdown |
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
""" | |
Handles creation of order_by criteria based on GET parameters and provides | |
context variables to be used when generating table header sort links which | |
respect the current sort field and direction, reversing the direction when | |
the same header is sorted by again. | |
""" | |
ORDER_VAR = 'o' | |
ORDER_TYPE_VAR = 'ot' | |
class SortHeaders: |
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
import urllib | |
from django import forms | |
from django.template.defaultfilters import filesizeformat | |
from django.utils.text import get_text_list | |
# Try to import PIL in either of the two ways it can end up installed | |
try: | |
from PIL import ImageFile as PILImageFile | |
except ImportError: |
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
""" | |
A widget for selecting from a list of Model instances using MultipleChoiceField | |
which renders a table row for each choice, consisting of a column for a checkbox | |
followed by a column for each item specified in item_attrs, which must specify | |
attributes of the objects passed as choices. | |
""" | |
from django.forms import CheckboxInput, SelectMultiple | |
from django.utils.encoding import force_unicode | |
from django.utils.html import escape | |
from django.utils.safestring import mark_safe |
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
> var forms = require("./js-forms"); | |
> var TestForm = forms.formFactory({fields: function() { | |
... return { | |
... name: new forms.CharField(), | |
... age: new forms.IntegerField() | |
... }; | |
... }}); | |
> | |
> var f = new TestForm(); | |
> f.toString() |
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
// From... | |
var TestForm = forms.formFactory({ | |
fields: function() { | |
return { | |
username: new forms.CharField(), | |
password: new forms.CharField({widget: forms.PasswordInput}) | |
}; | |
}, | |
clean: function() { | |
if (this.cleanedData.username && this.cleanedData.password && |
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
# usage: anon.py input.xml output.xml | |
import random | |
import string | |
import sys | |
from lxml import etree | |
XPATHS = [ | |
'/Path/To/Elements/*', | |
'/Another/Path/' |
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
repr([1, 2, 3, 4].map(function(i) { return require('./testrequire' + i).foo; })) | |
["bar", undefined, undefined, "bar"] |
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
{% extends 'base.html' %} | |
{% block title %}Comments{% endblock %} | |
{% block content %} | |
<h1>Comments</h1> | |
<form action="." method="POST"> | |
{% csrfToken %} | |
{% if form.nonFieldErrors.isPopulated %} | |
{{ form.nonFieldErrors }} |
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
// Request settings from the extension's localStorage and kick things off | |
chrome.extension.sendRequest({type: "getprefs"}, function(response) | |
{ | |
cachedSettings = response; | |
init(); | |
}); |
OlderNewer