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 | |
class Category(models.Model): | |
title = models.CharField(verbose_name=u'Заголовок', max_length=255) | |
left = models.IntegerField(blank=True, null=True) | |
right = models.IntegerField(blank=True, null=True) | |
parent = models.ForeignKey(verbose_name=u'Родительская категория', to='self', blank=True, null=True, related_name='children') | |
position = models.IntegerField(verbose_name=u'Позиция', blank=True, null=True) | |
level = models.IntegerField(blank=True, null=True) | |
published = models.BooleanField(verbose_name=u'Опубликован', default=True) |
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
Category.objects.all() |
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
<VirtualHost *:80> | |
DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs/" | |
ServerName localhost | |
<Directory "/Applications/XAMPP/xamppfiles/htdocs/"> | |
Options Indexes FollowSymLinks Includes execCGI | |
AllowOverride All | |
Require all granted | |
</Directory> | |
</VirtualHost> |
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 h_hght = 150; // высота шапки | |
var h_mrg = 0; // отступ когда шапка уже не видна | |
$(function(){ | |
var elem = $('#top_nav'); | |
var top = $(this).scrollTop(); | |
if(top > h_hght){ | |
elem.css('top', h_mrg); |
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
function randomFun() { | |
var items = $('.block-hit img'), randonItem; | |
randonItem = items.eq(Math.floor(Math.random() * items.length)); | |
randonItem.show() | |
} | |
randomFun(); |
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
function selfRandom(min, max) | |
{ | |
return Math.floor(Math.random() * (max - min + 1)) + min; | |
} |
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
RewriteEngine on | |
RewriteCond %{HTTP:Accept-encoding} gzip | |
RewriteCond %{REQUEST_FILENAME}\.gz -s | |
RewriteRule ^(.*)\.css $1\.css\.gz [QSA] | |
RewriteCond %{HTTP:Accept-encoding} gzip | |
RewriteCond %{REQUEST_FILENAME}\.gz -s | |
RewriteRule ^(.*)\.js $1\.js\.gz [QSA] |
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
grep -rl 'слово' /dir/subdir/ |
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
$('КНОПКА').click(function(){ | |
if($('ОБЪЕКТ').attr('style')){ | |
$('ОБЪЕКТ').fadeOut(600); | |
setTimeout("$('ОБЪЕКТ').removeAttr('style')", 700); | |
} | |
else{ | |
$('ОБЪЕКТ').fadeIn(600); | |
} | |
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
function heightDetect(){ | |
$('.main_head').css('height', $(window).height()); | |
}; | |
heightDetect(); | |
$(window).resize(heightDetect()); |
NewerOlder