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 sys, shutil, os, tempfile | |
from cStringIO import StringIO | |
TIMEOUT = 5 | |
# SANDBOX_BIN = '/usr/bin/pypy-sandbox' | |
SANDBOX_BIN = '/home/ubuntu/pypy/pypy/goal/pypy-c' # update this for you | |
sys.path = [ '/home/ubuntu/pypy'] + sys.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
<html> | |
<title>Hi</title> | |
<body> | |
he he he | |
</body> | |
</html> |
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
<html> | |
<head> | |
<title>Hey {{name|default:"there"}}!</title> | |
</head> | |
<body> | |
It's a lovely day, eh {{name|default:"chap"}}? | |
</body> | |
</html> |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title> anyas page </title> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script> | |
<script> | |
$(function(){ | |
$("a").click(function(){ | |
alert("clicked"); | |
return false; |
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
class ArticlePreviewTests(TestCaseBase): | |
#..... | |
def test_comments_no_linkify(self): | |
d = _create_document(title='Template:Foo') | |
revision(document=d, | |
is_approved=True, | |
is_ready_for_localization=True, | |
save=True, |
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
#!/usr/bin/env python | |
# By Tim Watts | |
# From http://readevalprint.com/blog/more-better-django-changed-instance-diff.html | |
# Updated on 9/22/2011 - Added Many2Many to supported fields | |
# Updated on 9/23/2011 - Fixed Many2Many fields | |
class Missing: | |
pass |
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 hashlib | |
import datetime | |
import urllib | |
# TODO: Create a thin wrapper to use settings.SECRET_KEY | |
def create(secret, **kwargs): | |
"""Create a signed, timestamped single use nonce from the given kwargs""" | |
m = hashlib.md5() |
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 django.shortcuts import get_object_or_404 | |
from django.contrib.auth import SESSION_KEY | |
from django import http | |
from django.contrib.auth.models import User | |
from django.contrib.auth.decorators import user_passes_test | |
@user_passes_test(lambda u: u.is_staff) | |
def su(request, username, redirect_url='/'): | |
su_user = get_object_or_404(User, username=username) | |
if su_user.is_active: |
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
def _remap_date_counts(**kwargs): | |
"""Remap the query result. | |
From: [{'count': 2085, 'month': 11, 'year': 2010},...] | |
To: {'<label>': 2085, 'date': '2010-11-01'} | |
""" | |
for label, qs in kwargs.iteritems(): | |
yield dict((date(x['year'], x['month'], 1), {label: x['count']}) | |
for x in qs) |
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
#!/usr/bin/env python | |
# To run this make sure you have selenium and bidpom | |
# pip install -U selenium | |
# git clone git://github.com/davehunt/bidpom.git | |
from selenium import webdriver | |
from bidpom.browser_id import BrowserID | |
browser = webdriver.Firefox() | |
browser.get('http://mozillians.allizom.org') |
OlderNewer