Skip to content

Instantly share code, notes, and snippets.

View vitalybaev's full-sized avatar

Vitaly Baev vitalybaev

View GitHub Profile
@vitalybaev
vitalybaev / createDebouncedAsyncThunk.ts
Created August 29, 2022 18:06 — forked from sarakusha/createDebouncedAsyncThunk.ts
A debounced analogue of `createAsyncThunk` from `@reduxjs/toolkit`
import { createAsyncThunk, AsyncThunkPayloadCreator, AsyncThunk } from '@reduxjs/toolkit';
type DebounceSettings = {
/**
* The maximum time `payloadCreator` is allowed to be delayed before
* it's invoked.
* @defaultValue `0`
*/
maxWait?: number;
/**
@vitalybaev
vitalybaev / .eslintrc.js
Created October 4, 2021 11:32 — forked from azinit/.eslintrc.js
imports-linting: order, access
/** Разрешенные импорты (для сортировки) */
const ALLOWED_PATH_GROUPS = ["pages/**", "features/**", "entities/**", "shared/**"].map(
(pattern) => ({
pattern,
group: "internal",
position: "after",
}),
);
/** Для запрета приватных путей */
@vitalybaev
vitalybaev / install-gnustep.sh
Created December 3, 2020 15:41 — forked from starbugs/install-gnustep.sh
A tiny shell script for installing GNUstep and libobjc2 automatically on Ubuntu 12. I recommend that you download this script to a distinct folder "gnustep-installer". It will download and unpack a couple of tar packages. For more information see my blog post http://blog.tlensing.org/2013/02/24/objective-c-on-linux-setting-up-gnustep-clang-llvm-…
#!/bin/bash
#
# Written by Tobias Lensing, http://tlensing.org
# For more information see http://blog.tlensing.org/2013/02/24/objective-c-on-linux-setting-up-gnustep-clang-llvm-objective-c-2-0-blocks-runtime-gcd-on-ubuntu-12-04/
#
PKG_OK=$(dpkg-query -W --showformat='${Status}\n' curl | grep "install ok installed")
echo Checking for curl: $PKG_OK
if [ "" == "$PKG_OK" ]; then
sudo apt-get install curl -y
@vitalybaev
vitalybaev / Hello.m
Created December 3, 2020 15:41 — forked from rainzoo/Hello.m
Compile and run Objective C program on Ubuntu 11.04
#import <Foundation/Foundation.h>
int main (int argc, const char *argv[])
{
@autoreleasepool {
NSLog(@"Hello World");
}
}
@vitalybaev
vitalybaev / gist:5b3b22a91829a2f8eedf17d98fd68fef
Created June 19, 2020 07:44 — forked from ayamflow/gist:b602ab436ac9f05660d9c15190f4fd7b
Safari border-radius + overflow: hidden + CSS transform fix
// Add on element with overflow
-webkit-mask-image: -webkit-radial-gradient(white, black);
@vitalybaev
vitalybaev / what-forces-layout.md
Created June 11, 2020 22:36 — forked from paulirish/what-forces-layout.md
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@vitalybaev
vitalybaev / debian8init.sh
Last active January 16, 2017 06:41
Debian 8 Init
# Устанавливаем русскую локаль
localedef ru_RU.UTF-8 -i ru_RU -fUTF-8
# Добавляем dotdeb.org репозиторий
wget https://www.dotdeb.org/dotdeb.gpg
apt-key add dotdeb.gpg
# Устанавливаем необходимые пакеты
apt-get install -y sudo nano build-essential apt-utils ntp sudo htop git zip apt-transport-https
apt-get install -y nginx php7.0 php7.0-curl php7.0-fpm php7.0-imagick php7.0-json php7.0-mbstring php7.0-mongodb php7.0-pdo-mysql php7.0-zip php7.0-dom
@vitalybaev
vitalybaev / ASDisplayNodeDraw
Created October 1, 2015 15:54 — forked from cemolcay/ASDisplayNodeDraw
ASDisplayNode draw shadow & border
override class func drawRect(
bounds: CGRect,
withParameters parameters: NSObjectProtocol!,
isCancelled isCancelledBlock: asdisplaynode_iscancelled_block_t!,
isRasterizing: Bool) {
let context = UIGraphicsGetCurrentContext()
CGContextSaveGState(context)
CGContextSetShadowWithColor(context, CGSize (width: 0, height: 1), 10, UIColor.TitleColor().CGColor)
VERSION=0.20.6
sudo apt-get update
sudo apt-get install openjdk-6-jdk
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-$VERSION.deb
sudo dpkg -i elasticsearch-$VERSION.deb
# be sure you add "action.disable_delete_all_indices" : true to the config!!
requests.put('http://localhost:9200/site/', data=json.dumps({
'settings': {
'analysis': {
'analyzer': {
'ru': {
'type': 'custom',
'tokenizer': 'standard',
"filter": ['lowercase', 'russian_morphology', 'english_morphology', 'ru_stopwords', 'ru_stemming'],
},
},