This file contains hidden or 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 Ember from 'ember'; | |
export default Ember.Component.extend({ | |
classNames: ['drag-box'], | |
attributeBindings: ['draggable'], | |
draggable: true, | |
x: 0, | |
y: 0, | |
positionChanged: Ember.observer('x', 'y', function(){ | |
this.$().css({ |
This file contains hidden or 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 single_pair_validator = function(hand){ | |
}; | |
var high_card_validation = function(white_numbered_hand, black_numbered_hand){ | |
for(var i=0; i < white_numbered_hand.length; i++){ | |
if(white_numbered_hand[i] > black_numbered_hand[i]){ | |
return "White wins"; | |
} | |
if(white_numbered_hand[i] < black_numbered_hand[i]){ |
This file contains hidden or 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
user nginx; | |
worker_processes 2; | |
error_log /var/log/nginx/error.log warn; | |
pid /var/run/nginx.pid; | |
events { | |
worker_connections 1024; | |
} |
This file contains hidden or 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.contrib.contenttypes.models import ContentType | |
from django.core.urlresolvers import reverse | |
from django.db import models | |
class AdminURLMixin(object): | |
def get_admin_url(self): | |
content_type = ContentType \ | |
.objects \ | |
.get_for_model(self.__class__) | |
return reverse("admin:%s_%s_change" % ( |
This file contains hidden or 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 tweepy | |
import inspect | |
import re | |
from django.conf import settings | |
from django import template | |
from django.utils.safestring import mark_safe | |
register = template.Library() |
This file contains hidden or 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.contrib.redirects.models import Redirect | |
from django.contrib.sites.models import Site | |
class BlogPost(models.Model): | |
... | |
slug = models.CharField(unique=true, max_length=128) | |
@models.permalink | |
def get_absolute_url(def): | |
return ('blogpost_detail', (), { 'slug' : self.slug }) |
This file contains hidden or 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
{% load smart_load %} | |
{% load thumbnail from sorl.thumbnail as sorl_thumbnail %} | |
{% load thumbnail from easy_thumnails as easy_thumbnail %} | |
{% sorl_thumbnail image.image "100x100" as im %} | |
<img src='{{ im.url }}' /> | |
{% endthumbnail %} | |
<img src='{% easy_thumbnail image.image "100x100" %}' /> |
This file contains hidden or 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.http import HttpResponseRedirect | |
from django.conf import settings | |
from fandjango.decorators import facebook_authorization_required | |
class ExtraFacebookMiddleware: | |
"""An extra layer of middleware on top of Fandjango to | |
enforce facebook authentication on every request. | |
This avoids having to decorate every view""" | |
def process_view(self, request, view_func, view_args, view_kwargs): |