Skip to content

Instantly share code, notes, and snippets.

View xfenix's full-sized avatar
😏
All commits are lost

Denis xfenix

😏
All commits are lost
View GitHub Profile
#!/usr/bin/env python
import sys
import logging
logger = logging.getLogger('wordsfrequency')
class WrongInputError(Exception):
pass
@xfenix
xfenix / speech.js
Last active August 7, 2018 20:13
Browser speech generator (with chrome chunk bug fix)
(function() {
// article voice synth
var SpeechGenerator = function() {
var that = this;
this.STATES = { STOP: 0, RUN: 1, PAUSE: 2 };
this.chunkSize = 190;
this.$root = $('.content');
this.subTitleClass = 'second_title';
this.status = this.STATES.STOP;
this.language = 'ru-RU';
@xfenix
xfenix / process-viewer.min.additional.js
Last active September 18, 2016 21:32
Global text search for bizagi web application (non-native, very dirty)
// поиск
$(function() {
$('.biz-ex-search-input, .biz-ex-btn-search, .biz-ex-search').unbind();
var $root = $('#search'),
$searchContainer = $('<ul>'),
$search = $root.find('.biz-ex-search-input'),
searchClassList = 'custom-ul ui-autocomplete ui-front ui-menu ui-widget ui-corner-all',
defaultSearchPlaceholder = 'Искать везде',
unicodeBoundaryStart = "(^\|[ \n\r\t.,'\"\+!?-]+)",
@xfenix
xfenix / linked_list.py
Last active May 24, 2016 13:25
Simple python Linked List implementation
class Node:
def __init__(self, value, next_item=None):
self.value = value
self.next = next_item
class LinkedList:
storage = []
def __init__(self):
def rupluralize(value, endings):
try:
endings = endings.split(',')
if value % 100 in (11, 12, 13, 14):
return endings[2]
if value % 10 == 1:
return endings[0]
if value % 10 in (2, 3, 4):
return endings[1]
else:
@xfenix
xfenix / russian_whoosh_backend.py
Last active October 22, 2021 20:31
Russian whoosh backend for haystack (added lemmatizing, requires pymorphy2)
from __future__ import unicode_literals
import os
import re
import shutil
import threading
import warnings
import pymorphy2
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
<?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 = 'Мобильные телефоны';
@xfenix
xfenix / gist:8c345822cc0162aebb7d
Created August 5, 2014 13:00
less -> sass migrate instruction
* spin -> adjust_hue
* @ -> $
* ...
@xfenix
xfenix / ie-warning.css
Created December 11, 2013 09:51
Nice jquery warning about old Internet Explorer
.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;
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)',