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
{ | |
"editor.fontSize": 14, | |
"files.exclude": { | |
"**/.git": true, | |
"**/.svn": true, | |
"**/.hg": true, | |
"**/CVS": true, | |
"**/.DS_Store": true, | |
"**/*.pyc": 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
akamud.vscode-theme-onedark | |
alefragnani.project-manager | |
amatiasq.sort-imports | |
bibhasdn.django-html | |
bungcip.better-toml | |
eamodio.gitlens | |
ecmel.vscode-html-css | |
emmanuelbeziat.vscode-great-icons | |
esbenp.prettier-vscode | |
golang.go |
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
let jq = document.createElement('script'); | |
jq.src = "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"; | |
document.getElementsByTagName('head')[0].appendChild(jq); | |
$('.message-body-link > .fa-pencil').click(); | |
$('.message-body-link > .fa-trash').each(function() { | |
$(this).click(); | |
$('.swal2-confirm').click(); | |
}) |
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
def compare_dicts(old_dict, new_dict): | |
diff_items = {} | |
for key, value in old_dict.items(): | |
if isinstance(value, dict): | |
result = compare_dicts(value, | |
new_dict[key] if key in new_dict and isinstance(new_dict[key], dict) else {}) | |
diff_items.update( | |
{'{}.{}'.format(key, sub_key): value for sub_key, value in result.items()}) | |
elif key not in new_dict or value != new_dict[key]: | |
diff_items[key] = value |
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 functools import reduce | |
def reducer(acc, number): | |
local_buf = [] | |
local_buf.append('Fizz' if number % 3 == 0 else '') | |
local_buf.append('Buzz' if number % 5 == 0 else '') | |
acc.append(''.join(local_buf) or str(number)) | |
return acc |
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
n=22 | |
z=[0]*(n-1) | |
for z[0] in range(z[-1],(n-sum(z[:0]))//(n-0)+1): | |
for z[1] in range(z[0],(n-sum(z[:1]))//(n-1)+1): | |
for z[2] in range(z[1],(n-sum(z[:2]))//(n-2)+1): | |
for z[3] in range(z[2],(n-sum(z[:3]))//(n-3)+1): | |
for z[4] in range(z[3],(n-sum(z[:4]))//(n-4)+1): | |
for z[5] in range(z[4],(n-sum(z[:5]))//(n-5)+1): | |
for z[6] in range(z[5],(n-sum(z[:6]))//(n-6)+1): | |
for z[7] in range(z[6],(n-sum(z[:7]))//(n-7)+1): |
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 ctypes import c_uint32 | |
def ellipsis(string: str, str_length: int, suffix: str = '...') -> str: | |
max_len: int = str_length + 1 | |
space: str = ' ' | |
if len(string) > max_len: | |
if string[max_len] == space: | |
return string[:max_len] + suffix | |
else: |
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
for item in range(1,101): print((('Fizz' if item % 3 == 0 else '') + ('Buzz' if item % 5 == 0 else '')) or item) |
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
/** | |
* Функция missing(), которая принимает неотсортированный массив уникальных | |
* чисел (то есть, числа в нём не повторяются) от 1 до некоего числа n, и возвращает число, | |
* отсутствующее в последовательности. Там может быть либо одно отсутствующее число, | |
* либо их может не быть вовсе. Сложность O(n) | |
*/ | |
function missing(seq) { | |
max_item = Math.max(...seq); | |
actual_summ = seq.reduce((acc, val) => acc + val, 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
""" | |
Wrapper for loading templates from the filesystem. | |
Cached version of https://github.com/django/django/blob/stable/1.7.x/django/template/loaders/filesystem.py | |
""" | |
from django.conf import settings | |
from django.template.base import TemplateDoesNotExist | |
from django.template.loader import BaseLoader | |
from django.utils._os import safe_join | |
from django.core.cache import cache as redis_cache |
NewerOlder