Skip to content

Instantly share code, notes, and snippets.

View xamedow's full-sized avatar
🏠
Working from home

Andrey Khamedov xamedow

🏠
Working from home
View GitHub Profile
import React from 'react';
import PropTypes from 'prop-types';
import cn from 'classnames';
import * as styles from './styles.scss';
import Button from '../Button/Button';
const AddButton = ({ children, className, title, onClick, ...props }) => (
<span className={cn(styles.button, className)} {...props}>
<label>
import { takeEvery, put } from 'redux-saga/effects';
import * as R from 'ramda';
import { createReducer } from 'redux-create-reducer';
import {DADATA_ADDRESS_API_URL, DADATA_KEY} from "../../shared/const";
import request from "../../sagas/request";
export const FETCH_ADDRESSES = 'FETCH_ADDRESSES';
export const FETCH_ADDRESSES_SUCCESS = 'FETCH_ADDRESSES_SUCCESS';
export const FETCH_ADDRESSES_ERROR = 'FETCH_ADDRESSES_ERROR';
@xamedow
xamedow / nginx.conf
Created March 7, 2019 08:26
server location usage for static files routing
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
@xamedow
xamedow / nginx.conf
Created March 7, 2019 08:05
Nginx static files for local virtual hosts support
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
@xamedow
xamedow / nginx.conf
Created June 18, 2018 07:12
Nginx virtual proxy host
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
send_timeout 1800;
sendfile on;
@xamedow
xamedow / bad-input.jsx
Created February 8, 2018 15:22 — forked from laytong/bad-input.jsx
How to debounce your inputs for super fast react/redux components
import React, {Component, PropTypes} from 'react';
class BadInputComponent extends Component {
static propTypes = {
text = PropTypes.string.isRequired,
updateText = PropTypes.func.isRequired,
};
render() {
return (
@xamedow
xamedow / temp.config
Created November 30, 2017 16:47
Nginx config template for serving static frontend bundle, along with local api server
upstream http_backend {
# INNER SERVER LOCAL IP:PORT
server 127.0.0.1:1337;
}
server {
listen 80;
server_name #YOUR SERVER IP OR DOMAIN;
# STATIC FRONTEND FILES
location / {
@xamedow
xamedow / event_handlers.php
Last active March 2, 2016 06:08
Bitrix event handler for upsert operations template
<?
// файл /local/php_interface/init.php
// регистрируем обработчик
AddEventHandler("iblock", "OnBeforeIBlockElementUpdate", Array("CIBlockHandler", "OnBeforeIBlockElementUpdateHandler"));
AddEventHandler("iblock", "OnBeforeIBlockElementAdd", Array("CIBlockHandler", "OnAfterIBlockElementAddHandler"));
/**
* Класс обработчик событий добавления/изменения элементов инфоблока «Учреждения (только подведомственные министерству!!!)».
* Разрешает запись выбранных полей только адимнистратору.
* Class CIBlockHandler
@xamedow
xamedow / .gitconfig
Last active October 22, 2015 11:19
local git configuration file
# This is Git's per-user configuration file.
[user]
# Please adapt and uncomment the following lines:
name = xamedow (Andrey Hamedov)
email = xamedow@gmail.com
[core]
editor = subl
[color "branch"]
current = yellow reverse
local = yellow
@xamedow
xamedow / ajax_xamedow.php
Created March 19, 2014 13:12
AJAX handler to refactor
<?php
session_start();
require_once("../mod/mod_config.php");
$filter = new filter;
if (isset($_POST['table'])) {
// Friends remover.
if ($_POST['table'] === 'friends') {
$person_id = $filter->html_filter(@$_POST['person_id']);
$friend_id = $filter->html_filter(@$_POST['friend_id']);