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
check revision or visit https://github.com/Blucknote/Kandinsky-advanced-notebooks |
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
import random | |
class Dictogram(dict): | |
def __init__(self, iterable=None): | |
# Инициализируем наше распределение как новый объект класса, | |
# добавляем имеющиеся элементы | |
super(Dictogram, self).__init__() | |
self.types = 0 # число уникальных ключей в распределении | |
self.tokens = 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
#!/bin/bash | |
AUTHOR=$(git config user.name) | |
DATE=$(date +%F) | |
git log --format="%cd" --date=short --no-merges --author="$AUTHOR" --all --after="2020-06-14" --until="2020-06-20" | sort -u -r | while read DATE ; do | |
if [ $NEXT != "" ] | |
then | |
echo | |
echo [$NEXT] | |
fi | |
GIT_PAGER=cat git log --no-merges --format=" %s" --since=$DATE --until=$NEXT --author="$AUTHOR" --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
const lazyLoad = function() { | |
let lazyImages = $("img.lazy:visible"); | |
setTimeout(function() { | |
$.each( | |
lazyImages, | |
function() { | |
let lazyImage = $(this)[0]; | |
if ((lazyImage.getBoundingClientRect().top <= window.innerHeight && lazyImage.getBoundingClientRect().bottom >= 0) && getComputedStyle(lazyImage).display !== "none") { | |
lazyImage.src = lazyImage.dataset.src; |
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
jQuery.each( | |
jQuery('a.download-button'), | |
function () { | |
var win = window.open( | |
jQuery(this).attr('href'), | |
'_blank' | |
); | |
win.focus(); | |
} | |
) |
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
/* | |
After purchasing a humble book bundle, go to your download page for that bundle. | |
Open a console window for the page and paste in the below javascript | |
this fork downloads all formats and does so without using jquery (since that didnt work for me) | |
note that if you are in chrome, chrome will not download the pdfs for you by default, to fix this | |
type “about:plugins” in the address bar and disable chrome's pdf viewer | |
*/ | |
var pattern = /(MOBI|EPUB|PDF)$/i; |
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 pluralize(n, lst): | |
if n % 10 == 1 and n % 100 != 11: | |
p = 0 | |
elif 2 <= n % 10 <= 4 and (n % 100 < 10 or n % 100 >= 20): | |
p = 1 | |
else: | |
p = 2 | |
return '{} {}'.format(str(n), lst[p]) |
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
lst = document.getElementsByClassName('docs_delete_row') | |
for (var i=0;i<lst.length; i++) { | |
lst[i].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
$('html, body').animate({scrollTop: $(selector).offset().top}, 300); |
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
$(selector).keydown(function (e) { | |
if (e.keyCode === 13) { | |
// code | |
} | |
if (!/[0-9]/.test(e.key) || $(this).val().length >= 4) { | |
if ( | |
e.keyCode != 8 && | |
e.keyCode != 46 && | |
e.keyCode != 36 && | |
e.keyCode != 35 && |
NewerOlder