Skip to content

Instantly share code, notes, and snippets.

<div id="d3">
sdf
<p>
1231
<a>
asdfasdf
<div id="d1">
1
</div>
</a>
@ErDmKo
ErDmKo / Django settings
Created October 24, 2015 11:55
__init__.py
import os
PATH = os.path.realpath(os.path.dirname(__file__))
if os.environ.get('PYTHONPATH'):
from .heroku import *
elif os.path.exists(os.path.join(PATH, 'local.py')):
from .local import *
else:
from .base import *
@ErDmKo
ErDmKo / .vimrc
Last active August 16, 2022 12:56
vim settings
colorscheme desert
set smartindent
set tabstop=4
set ruler
set nu
syntax on
set backupcopy=yes
set shiftwidth=4
set laststatus=2
set expandtab
@ErDmKo
ErDmKo / Infinity
Created February 9, 2015 06:51
Infinity loop
(itemIndex - 1) % COLORS.length
@ErDmKo
ErDmKo / xml2json.py
Last active February 25, 2023 07:58
simple convert xml to json with lxml
from lxml import etree
root = etree.fromstring(xml_str)
def xml2json(self, root):
children = root.findall('ResponseData/ResponseDataObject')[0]
def recusiv(children):
out = {}
for child in list(children):
if len(list(child)):
@ErDmKo
ErDmKo / proc.sql
Last active August 29, 2015 14:02
Change table engine for the all tables in the db
vim
%s/InnoDB/MyISAM/g
g/CONSTRAINT/d
%s/)\,\n)/\)\r\)/g
SET foreign_key_checks = 0;
drop procedure if exists `to_MyISAM`;
CREATE PROCEDURE `to_MyISAM` ()
BEGIN
DECLARE a,c VARCHAR(256);
$('body').on('click', '.open_close_sel', function(e){
var self = $(this);
popup = self.children('dd'),
group = self.add(popup);
$('.open_close_sel > dd').filter(function(e){
return !$(this).is(popup)
}).removeClass('open').closest('.open_close_sel').removeClass('open');
$(document).off('.custom_select').on('click.custom_select', function(e, f){
@ErDmKo
ErDmKo / carousel.js
Last active August 29, 2015 14:00
carousel
=decor_pseudo($after)
position: relative
&:#{$after}
content: ''
position: absolute
@content
=keyframes($name)
@-webkit-keyframes #{$name}
@content
#it is not working
@sql_f = SELECT group_concat(CONCAT("ALTER TABLE ",TABLE_SCHEMA,".",TABLE_NAME," CHARACTER SET utf8 COLLATE utf8_general_ci; ",
"ALTER TABLE ",TABLE_SCHEMA,".",TABLE_NAME," CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci; ") SEPARATOR '; ')
AS alter_sql
FROM information_schema.TABLES
WHERE TABLE_SCHEMA = 'tc-akvarel_ru';
PREPARE sql FROM @sql_f;
EXECUTE sql;