Skip to content

Instantly share code, notes, and snippets.

View ekazakov's full-sized avatar

Evgenii Kazakov ekazakov

  • Berlin
  • 21:36 (UTC -12:00)
View GitHub Profile
@ekazakov
ekazakov / index.html
Created January 17, 2022 14:44 — forked from idahopotato1/index.html
Resize, Drag, Snap
<div id="pane">
<div id="title">Resize, Drag or Snap Me!</div>
</div>
<div id="ghostpane"></div>
@ekazakov
ekazakov / MainScreen.tsx
Last active November 12, 2021 21:38
Оптимизация
import { AppRoute } from '../../const';
import { Point } from '../../types/offers';
import Header from '../header/header';
import Map from '../map/map';
import { useState } from 'react';
import LocationsList from '../locations-list/locations-list';
import { connect, ConnectedProps } from 'react-redux';
import { bindActionCreators, Dispatch } from 'redux';
import { changeCity } from '../../store/action';
import { State } from '../../types/state';
const roomNumberInput = adForm.querySelector("#room_number");
const capacityInput = adForm.querySelector("#capacity");

// на selectы с кол-вом комнат и гостей надо добавить обработчик на событие change
// Если пользователь изменил кол-во гостей(capacity), то сработает обработчик события для capacityInput
// в нем надо проверить, что текущее кол-во гостей можно разместить в выбранном кол-ве комнат
// Аналогично для кол-ва комнат(roomNumber).

capacityInput.addEventListener("change", (evt) => {
@ekazakov
ekazakov / gist:d36769678c81acba59c27f5052303c46
Created May 10, 2021 19:35
Jest fake timers and promises pitfall
https://github.com/sinonjs/fake-timers/issues/114
https://stackoverflow.com/questions/50783013/how-to-timeout-promises-in-jest
https://stackoverflow.com/questions/51126786/jest-fake-timers-with-promises
https://github.com/facebook/jest/issues/5165
https://github.com/facebook/jest/issues/5165#issuecomment-640212362 — Use sinon fake timer config directly
https://github.com/facebook/jest/issues/10221
Transpile hack in jest:
@ekazakov
ekazakov / Parallel_Tools_fix_for_Ubuntu_19.04.md
Created December 17, 2019 22:19 — forked from mag911/Parallel_Tools_fix_for_Ubuntu_19.04.md
Parallel Tools fix for Ubuntu 19.04, 19.10, 18.04

First off, credit goes to github.com/rudolfratusinski for leading the way here.

https://gist.github.com/rudolfratusinski/a4d9e3caff11a4d9d81d2e84abc9afbf

In a very similar approach, copy the files from the Parallels installation media and drop them in a folder somewhere (eg. ~/parallels_fixed)

Go to the kmods directory (cd ~/parallels_fixed/kmods) and extract the files (tar -xzf prl_mod.tar.gz)

Remove prl_mod.tar.gz file from that directory (rm prl_mod.tar.gz)

@ekazakov
ekazakov / index_raw.js
Created October 15, 2015 21:55
Pre resolve promises
angular.module('app', [])
.decorator('$controller', function ($delegate) {
return function () {
var result = $delegate.apply(null, arguments);
return result;
};
})
.factory('lib',function ($q) {
return $q.when('Hello');
})
@ekazakov
ekazakov / js-metaobjects.md
Last active August 29, 2015 14:16
JS Metaobjects

Пишем свою объектную модель на JavaScript

Введение

Эта статья является вольным изложением идей из этой замечательной книги JavaScript Spressore (обязательно к прочтению).

@ekazakov
ekazakov / user-npm-owner.sh
Last active August 29, 2015 14:16
Install local and global node modules without sudo
sudo chown -R $USER ~/.npm
sudo chown -R $USER /usr/local/lib/node_modules
# Has your OS/FS/disk lost your data?
# cd to the directory containing your project repositories and run the command
# below. (It's long; make sure you get it all.) It finds all of your git repos
# and runs paranoid fscks in them to check their integrity.
(set -e && find . -type d -and -iname '.git' | while read p; do (cd "$(dirname "$p")" && (set -x && git fsck --full --strict)); done) && echo "OK"
# I have 81 git repos in my ~/proj directory and had no errors.
@ekazakov
ekazakov / nginx.conf
Created May 8, 2014 19:10
Переменная с путем до директории проектов
map $host $projects_root {
default "/Volumes/Storage_1/Workspace";
}
include sites/*.conf;
include /Volumes/Storage_1/Workspace/**/*.conf;