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
def str_replace_multi(string, replacements, empty_if_list=True): | |
try: | |
iterator = repls.iteritems() | |
except: | |
if isinstance(replacements, (list, tuple)): | |
first = iter(replacements) | |
second = ['']*len(replacements) if empty_if_list else\ | |
first | |
iterator = dict(zip(first, second)) | |
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
class UsualCustomResourceTestCase(CustomResourceTestCase): | |
tested_object = None | |
resource_object = None | |
resources = None | |
created_stack = [] | |
generated_numbers = [] | |
exclude_fields = ['created', 'modified'] | |
exclude_ignore_fields = ['name', ] | |
username = 'dmitri' | |
password = '12345' |
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 ExtjsTreeResource(ExtJsModelResource): | |
max_limit = 1000 | |
cache_group = '' | |
cache_ttl = 3600 | |
cache_url_params = ['offset', 'page', 'limit', 'node'] | |
tree_parent_key = '' | |
tree_childs_key = 'childs' | |
tree_id_key = 'id' | |
def prepend_urls(self): |
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
tree_already_apended = [] | |
tree_childs_key = 'childs' | |
data = [ | |
dict( | |
id=1, | |
parent=None | |
), | |
dict( | |
id=2, | |
parent=1 |
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 CacheGroup(object): | |
ttl = 3600 | |
initial = 1 | |
group = '' | |
def __init__(self, group, ttl): | |
self.group = group | |
self.ttl = ttl | |
def key(self, key): |
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
$.fn.followTo = function (pos) { | |
var $this = this, | |
$window = $(window); | |
$window.scroll(function (e) { | |
if ($window.scrollTop() > pos) { | |
$this.css({ | |
position: 'absolute', | |
top: pos | |
}); |
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 Number(models.Model): | |
MASKS = dict( | |
xyxy=r'(?:(\d)((?!\1)\d)\1\2)', | |
xyyx=r'(?:(\d)((?!\1)\d)\2\1)', | |
xxyy=r'(?:(\d)\1((?!\1)\d)\2)', | |
two_digits=lambda value, where: Number.match_two_digits(value), | |
sequence=lambda value, where: Number.match_sequence(value, where), | |
x0y0z0=r'(?:(\d)0((?!\1)\d)0((?!\1|\2)\d)0)', | |
xyzaxyz=r'(?:(\d)((?!\1)\d)((?!\1|\2)\d)\d\1\2\3)', | |
xyzxyza=r'(?:(\d)((?!\1)\d)((?!\1|\2)\d)\1\2\3\d)', |
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
.old-browsers { | |
position: fixed; | |
top: 0; | |
left: 0; | |
right: 0; | |
background: #FCB3BC; | |
border-bottom: 5px solid #E1A0A8; | |
color: #000; | |
text-shadow: none; | |
text-align: center; |
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
* spin -> adjust_hue | |
* @ -> $ | |
* ... | |
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
<?php | |
libxml_use_internal_errors(true); | |
class Spider { | |
private $basicUrl = 'http://euroset.ru/'; | |
private $restrictedSectionTitles = []; | |
const SECTION_MOBILE = 1; | |
const SECTION_PAD = 2; | |
const SECTION_MOBILE_TITLE = 'Мобильные телефоны'; |