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
public Set<String> signatureToWords(String signature){ | |
Set<String> words = new HashSet<String>(); | |
int index = (Collections.binarySearch(dictionary, new WordSig("", signature))*-1-2); | |
//System.out.println("Index: "+index); | |
int x = index; | |
String currentSig = dictionary.get(x).getSig(); | |
String currentWord = dictionary.get(x).getWords(); | |
/** | |
if(PredictivePrototype.isValidWord(currentWord)){ | |
words.add(currentWord.toLowerCase()); |
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 CommentForm(f.ModelForm): | |
class Meta: | |
model = Review | |
class CommentCreateView(CreateView): | |
model = Comment | |
form_class = CommentForm | |
@method_decorator(login_required) | |
def dispatch(self, *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
class ReviewForm(f.ModelForm): | |
class Meta: | |
model = Review | |
class CommentCreateView(CreateView): | |
model = Comment | |
form_class = CommentForm | |
@method_decorator(login_required) | |
def dispatch(self, *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
#encoding: UTF-8 | |
from django.conf import settings | |
from django.core.exceptions import ViewDoesNotExist | |
from django.http import HttpResponse | |
from django.template import RequestContext,Template,loader,TemplateDoesNotExist | |
from django.utils.importlib import import_module | |
import httplib | |
class HttpException(Exception): |
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.forms import ModelForm, HiddenInput, MultipleHiddenInput, Textarea | |
from models import Thing, Review, UserProfile | |
from rays.widgets import RangeInput | |
class ReviewForm(ModelForm): | |
mentioned = Textarea() | |
class Meta: | |
model = Review | |
exclude = ("author",) |
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"), | |
) |