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
{% extends "base.html" %} | |
{% block content %} | |
<form method="POST" action="{{ dest }}"> | |
<input type="hidden" name="confirm" value="no" /> | |
<input type="submit" value="No" /> | |
</form> | |
<form method="POST" action="{{ dest }}"> | |
<input type="hidden" name="confirm" value="yes" /> | |
<input type="submit" value="Yes" /> |
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
#!/usr/bin/env python | |
class Server(object): | |
def __init__(self, id, name, status, public_ip, private_ip): | |
self.id = id | |
self.name = name | |
self.status = status | |
self.public_ip = public_ip | |
self.private_ip = private_ip |
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 import template | |
from django.contrib.contenttypes.models import ContentType | |
from django.contrib.humanize.templatetags.humanize import intcomma, intword | |
from whereabouts.models import SocialNetworkProfile | |
import facebook | |
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
class ReverseProxied(object): | |
def __init__(self, app): | |
self.app = app | |
def __call__(self, environ, start_response): | |
script_name = environ.get('HTTP_X_SCRIPT_NAME', None) | |
if script_name is not None: | |
environ['SCRIPT_NAME'] = script_name | |
path_info = environ['PATH_INFO'] | |
if path_info.startswith(script_name): |
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 import template | |
from django.contrib.humanize.templatetags.humanize import intcomma, intword | |
import facebook | |
register = template.Library() | |
@register.simple_tag | |
def likes(current_site): |
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.conf.urls.defaults import * | |
from views import ApprovedStoryList, CreateStory | |
urlpatterns = patterns( | |
'', | |
url(r'^$', ApprovedStoryList.as_view(), name="index"), | |
url(r'^share/$', CreateStory.as_view(), name="share"), | |
) |
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.conf.urls.defaults import * | |
from views import ApprovedStoryList, CreateStory | |
urlpatterns = patterns( | |
'', | |
(r'^$', ApprovedStoryList.as_view()), | |
(r'^share/$', CreateStory.as_view()), | |
) |
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
class RingtoneDetailView(SingleObjectTemplateResponseMixin, ChooseTemplateMixin, SingleObjectMixin, FormMixin, TemplateResponseMixin, ProcessFormView): | |
model = Ringtone | |
form_class = RingtoneForm | |
def dispatch(self, *args, **kwargs): | |
request = args[0] | |
device_info = choose_site(request) | |
self.site_type = device_info['site_type'] | |
self.device = device_info['device'] | |
return super(RingtoneDetailView, self).dispatch(*args, **kwargs) |
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 os | |
import sublime | |
import sublime_plugin | |
class Pep8CheckCommand(sublime_plugin.EventListener): | |
def on_post_save(self, view): | |
if view.file_name().endswith('.py'): | |
folder_name, file_name = os.path.split(view.file_name()) | |
view.window().run_command('exec', {'cmd': ['flake8', |
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 djcelery | |
djcelery.setup_loader() | |
import redis | |
import tweepy | |
from twitpop.tasks import score_tweet | |
db = redis.Redis(host='localhost', port=6379, db=0) |