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
WITH a AS ( | |
SELECT sportsmen_id FROM chalenge_results r | |
INNER JOIN | |
chalenge_chalengesporter s | |
ON r.sportsmen_id = s.id | |
WHERE date_part('year', s.date_req) = 2017 | |
) | |
UPDATE chalenge_results as c | |
SET chalenge_id = 2 |
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
# -*- coding: utf-8 -*- | |
from __future__ import unicode_literals | |
from django.contrib import admin | |
from redactor.widgets import RedactorEditor | |
from django.contrib.flatpages.models import FlatPage | |
from django.contrib.flatpages.admin import FlatPageAdmin as FlatPageAdminOld | |
class FlatPageAdmin(FlatPageAdminOld): | |
formfield_overrides = { | |
models.TextField: {'widget': RedactorEditor}, |
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
<head> | |
<!-- Facebook – 1,200 x 628 | |
Twitter – 1,024 x 576 | |
Instagram – 1,080 x 1,080 | |
LinkedIn – 552 x 368 | |
Pinterest – 600 x 900 | |
Google+ – 800 x 320 | |
--> | |
<title>Заголовок страницы</title> |
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
# python / django regexp for phone validating | |
# regexp | |
r'^\+?1?\d{9,15}$' | |
# django validator | |
from django.core.validators import RegexValidator | |
phone_regex = RegexValidator(regex=r'^\+?1?\d{9,15}$', message=u'Phone number must be like: +79999999999') |
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
// remove .pyc files | |
rm -r *.pyc | |
// recursive | |
find . -name "*.pyc" -exec rm -f {} \; | |
// http://stackoverflow.com/questions/785519/how-do-i-remove-all-pyc-files-from-a-project |
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
<!-- template.html --> | |
{% for item in items %} | |
<a href="{{item.slug}}">{{item.name}}</a>{% include "comma.html" %} | |
{% endfor %} | |
<!-- comma.html --> | |
{% if not forloop.last %} | |
{% ifequal forloop.revcounter 2 %} и {% else %}, {% endifequal %} | |
{% else %} |
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
// This function gets cookie with a given name | |
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)); |