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 django import template | |
register = template.Library() | |
@register.filter() | |
def phone(value): | |
return '+%s %s %s %s %s' % (value[0], |
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
'use strict'; | |
angular.module('appName') | |
.directive 'birthday', () -> | |
return { | |
restrict: 'E' | |
scope: | |
date: '=' | |
yearBegin: '=' | |
yearEnd: '=' |
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 server = require('webserver').create(); | |
var port = 9091; | |
var getPage = function(url, callback) { | |
var page = require('webpage').create(); | |
page.open(url, function() { | |
setTimeout(function() { | |
page.evaluate(function() { | |
$('meta[name=fragment], script').remove() |
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 django import template | |
register = template.Library() | |
@register.assignment_tag(takes_context=True) | |
def is_owner(context, obj, user, field_name='user'): | |
return getattr(obj, field_name, None) == user |
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 django.core.urlresolvers import reverse | |
from django.utils.translation import ugettext_lazy as _ | |
from admin_tools.dashboard import modules | |
from admin_tools.dashboard import Dashboard | |
from admin_tools.menu import Menu | |
from admin_tools.menu import items | |
from project.dashboard_modules import WorkedTaskDashboardModuleChart |
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
server { | |
listen 80; | |
server_name project.ru www.project.ru; | |
access_log /var/log/nginx/project-access.log; | |
error_log /var/log/nginx/project-error.log; | |
root /home/www/project/; | |
location /static/ { |
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
[uwsgi] | |
processes = 2 | |
env = DJANGO_SETTINGS_MODULE=project.settings | |
module = project.wsgi | |
chdir = /home/www/%n/ | |
virtualenv = /home/www/%n/.env/ | |
pythonpath = /home/www/%n/ |
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
server { | |
# ... | |
location /api/ { | |
uwsgi_pass unix:///var/run/uwsgi/app/project/socket; | |
include uwsgi_params; | |
uwsgi_buffers 8 128k; | |
client_max_body_size 10M; | |
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 -*- | |
import json | |
from django.http import HttpResponse | |
from django.views.generic import FormView | |
class BaseAJAXFormView(FormView): | |
mimetype = 'application/json' | |
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
setContentHeight = () -> | |
$content = $('#content') | |
setMainHeight = () -> | |
height = $(window).height() - $('#menu').outerHeight() - $('#footer').outerHeight() | |
$content.height height | |
setMainHeight() | |
$(window).resize () -> |
OlderNewer