Skip to content

Instantly share code, notes, and snippets.

@Arbagen
Arbagen / git allias
Last active May 23, 2017 09:35
git allias
[alias]
br = branch
s = status --short
co = checkout
st = status
c = commit -am
@Arbagen
Arbagen / git-update-index
Created March 21, 2017 00:49
git unwatch files
git-update-index --[no-]assume-unchanged
When this flag is specified, the object names recorded for the paths are not updated.
Instead, this option sets/unsets the "assume unchanged" bit for the paths. When the "assume unchanged" bit is on,
the user promises not to change the file and allows Git to assume that the working tree file matches what is recorded in the index.
If you want to change the working tree file, you need to unset the bit to tell Git. This is sometimes helpful when working with a
big project on a filesystem that has very slow lstat(2) system call (e.g. cifs).
Git will fail (gracefully) in case it needs to modify this file in the index e.g. when merging in a commit; thus,
in case the assumed-untracked file is changed upstream, you will need to handle the situation manually.
@Arbagen
Arbagen / solution
Created May 3, 2017 19:36
phpmyadmin HTTP ERROR 500
sudo apt-get install php-mbstring php7.0-mbstring php-gettext
@Arbagen
Arbagen / xdebug.md
Created May 23, 2017 09:34
install xdebug

🪲 Install and Configure xDebug on Ubuntu and Php Storm 🐘

  • Assuming that you have already installed php and apache
  • Install xDebug php extension
# Ubuntu 16.04, php 7.0
sudo apt-get install php-xdebug
# Ubuntu 14.04, php 5.6 
sudo apt-get install php5-xdebug
@Arbagen
Arbagen / pdo connection
Created May 24, 2017 14:33
php true pdo connection
$host = '127.0.0.1';
$db = 'test';
$user = 'root';
$pass = '';
$charset = 'utf8';
$dsn = "mysql:host=$host;dbname=$db;charset=$charset";
$opt = [
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
unzip -p dump.zip | mysql -h 127.0.0.1 -P 3306 -u root -p projects_ndb
@Arbagen
Arbagen / xdebug in docker and phpstorm
Last active January 15, 2018 10:27
xdebug in docker and phpstorm
важно что бы в php.ini было:
xdebug.remote_host=dockerhost
xdebug.remote_enable = 1
xdebug.remote_port = 9000
xdebug.max_nesting_level = 500
xdebug.remote_autostart=1
xdebug.remote_connect_back=1
а в docker-compose экспортнуть переменную PHP_IDE_CONFIG
services:
php:
@Arbagen
Arbagen / gist:f5c705ce0e9b5f140e368616b5ce2ea5
Created March 12, 2018 09:46
mysql update random string (8 chars)
UPDATE table SET field = LEFT(UUID(), 8);
@Arbagen
Arbagen / vim macros
Created May 18, 2018 08:10
vim macros
To enter a macro, type:
q<клавиша a-Z><делаешь какие то действия>q
в режиме команд
To execute the macro <number> times (once by default), type:
<кол-во раз>@<клавишу на которую забиндил>
@Arbagen
Arbagen / email regex
Last active October 26, 2018 08:46
email regex
^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}