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
@xamedow
xamedow / gist:9192857
Created February 24, 2014 17:32
Simple menu class
<?php
class menu
{
private $data_arr = array();
private $page_name = '';
private $default_module = '';
/**
* @param array $data_arr
@xamedow
xamedow / xamedow.js
Created March 19, 2014 13:05
AJAX sender to refactor
// Fields check
$('[name="group_name"]').blur(function() {
var value = $(this).val();
var target = $(this).next();
target.html('<img>');
function getWarn(target, text) {
text = text || 'Поле не заполнено';
target.find('img').attr('src', '/images/del_icon.png');
target.html(target.html() + text);
@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']);
@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 / 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 / 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 / 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 / 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 / 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 March 7, 2019 08:26
server location usage for static files routing
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;