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
# coding: utf-8 | |
from datetime import datetime | |
try: | |
import simplejson as json | |
except ImportError: | |
import json | |
datetime_json_handler = lambda obj: obj.isoformat() if isinstance(obj, datetime) else None |
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
/* | |
Usage: | |
$(document).ready(function() { | |
$('#tabs').prefix_tab({ | |
prefix: 'settings_', | |
default_route: 'general' | |
}); | |
}); |
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
.pill { | |
margin: 0; | |
text-align: center; | |
display: inline-block; | |
position: relative; | |
} | |
.pill.pill-large a { | |
height: 100px; | |
line-height: 100px; |
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.db import models | |
from django.contrib.contenttypes.models import ContentType | |
from django.contrib.contenttypes import generic | |
class RelationManager(models.Manager): | |
""" | |
Contains helpful methods for operating with Relation model | |
""" |
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 __future__ import print_function | |
from tornado.gen import Task, Return, coroutine | |
import tornado.process | |
import subprocess | |
from tornado.ioloop import IOLoop | |
STREAM = tornado.process.Subprocess.STREAM | |
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
#!/bin/bash | |
DAEMON_DIR=/opt/mytornadoapp | |
DAEMON=$DAEMON_DIR/main.py | |
NAME=tornado | |
DESC="tornado daemon" | |
test -f $DAEMON || exit 0 | |
set -e |
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 import forms | |
from django.forms.forms import BoundField | |
from django.utils.datastructures import SortedDict | |
class BoundFieldset(object): | |
def __init__(self, form, name, title, fields, is_fieldset): | |
self.form = form | |
self.name = name |
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
/path/to/location/ method=POST contents="name=TEST&password=SECRET" |
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
// using jQuery | |
function getCookie(name) { | |
var cookieValue = null; | |
if (document.cookie && document.cookie != '') { | |
var cookies = document.cookie.split(';'); | |
for (var i = 0; i < cookies.length; i++) { | |
var cookie = jQuery.trim(cookies[i]); | |
// Does this cookie string begin with the name we want? | |
if (cookie.substring(0, name.length + 1) == (name + '=')) { | |
cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); |
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 __future__ import print_function | |
import tornado.httpclient | |
import tornado.ioloop | |
import tornado.web | |
import tornado.gen | |
@tornado.gen.coroutine | |
def get(): | |
urls = [ |