Skip to content

Instantly share code, notes, and snippets.

Avatar
🤔
Working

Vladimir Chmil Ulv

🤔
Working
View GitHub Profile
@Ulv
Ulv / phpdox.xml
Created Aug 14, 2018
phpdox working config
View phpdox.xml
<?xml version="1.0" encoding="utf-8" ?>
<!-- This is a skeleton phpDox config file - Check http://phpDox.de for latest version and more info -->
<phpdox xmlns="http://xml.phpdox.net/config" silent="false">
<!-- @silent: true | false to enable or disable visual output of progress -->
<!-- Additional bootstrap files to load for additional parsers, enrichers and/or engines -->
<!-- Place as many require nodes as you feel like in this container -->
<!-- syntax: <require file="/path/to/file.php" /> -->
<bootstrap />
@Ulv
Ulv / pre-push
Last active Aug 14, 2018
Автоматическое обновление документации по хуку pre-push
View pre-push
#!/bin/sh
rm -rf "$(pwd)/docs"
phpmd ./src xml cleancode,codesize,controversial,design,naming,unusedcode > "$(pwd)/build/pmd.xml"
phpcs ./src --report-xml="$(pwd)/packages/bitcoin/build/phpcs.xml"
phploc ./src --log-xml="$(pwd)/build/phploc.xml"
phpdox && git add --all docs && git commit -m "Автоматическое обновление документации phpdox"
@Ulv
Ulv / fastKeysCallback.php
Last active Jan 3, 2017
Function to apply callback to multiple keys defined by pattern.fastKeysCallback() uses redis SCAN with 100 elements
View fastKeysCallback.php
$redis = new Redis();
$redis->pconnect('127.0.0.1', 33379);
/**
* @param $redis
* @param string $mask
* @param $callback
*
* @return array|bool
*/
@Ulv
Ulv / mysql_createdb.sql
Last active Jan 10, 2017
Creates mysql database and user with permissions
View mysql_createdb.sql
CREATE DATABASE IF NOT EXISTS dbname;
GRANT ALL PRIVILEGES ON dbname.* TO 'dbuser'@'localhost' IDENTIFIED BY 'dbpassword';
FLUSH PRIVILEGES;
@Ulv
Ulv / createdb.sh
Created May 21, 2016
Create mysql database and user
View createdb.sh
#!/bin/bash
EXPECTED_ARGS=3
E_BADARGS=65
MYSQL=`which mysql`
Q1="CREATE DATABASE IF NOT EXISTS $1;"
Q2="GRANT ALL ON *.* TO '$2'@'localhost' IDENTIFIED BY '$3';"
Q3="FLUSH PRIVILEGES;"
SQL="${Q1}${Q2}${Q3}"
@Ulv
Ulv / gist:4f5b40c1c891014ff66c5d474cddf8e6
Created May 21, 2016
Rewrite git commiter in repository
View gist:4f5b40c1c891014ff66c5d474cddf8e6
git filter-branch --commit-filter 'export GIT_AUTHOR_NAME="author" ; export GIT_AUTHOR_EMAIL=email@mail.com; git commit-tree "$@"'
@Ulv
Ulv / .gitignore
Created Jan 24, 2015
Ignore emacs autosave files, .projectile and TAGS
View .gitignore
TAGS
.projectile
\#*
*~
.#*
\#*\#
@Ulv
Ulv / gist:b5372b43279e60b3b8e6
Created Jan 17, 2015
JavaScript GET parameter to object - fill form field
View gist:b5372b43279e60b3b8e6
/*
* автоматом отмечает значения, которые пришли в переменных GET
* запрос - строка вида worktype=100&second=35
*
* Здесь:
* worktype - имя и значение option основного селекта
* second - имя и значение option зависимого (второго) селекта
*/
$.fn.extend({
@Ulv
Ulv / gist:97a6aa5138a6ad96ea40
Created Jan 12, 2015
js modal dialog: send mail, countdown and redirect
View gist:97a6aa5138a6ad96ea40
/*
* form mail + модальное окно при сабмите
*/
$.fn.extend({
diplomMailForm: function(data) {
countdown = function (element, seconds, minutes) {
var interval;
minutes = minutes || 0;
seconds = seconds || 5;
return interval = setInterval(function () {
@Ulv
Ulv / Robokassa.php
Created Nov 8, 2014
Класс для работы с робокассой с обновлением курса с ЦБРФ для yii
View Robokassa.php
<?php
/**
* класс для работы с робокассой
*
* PHP version 5.3
*
* @author ladamalina
* @author Vladimir Chmil <vladimir.chmil@gmail.com>
*