Skip to content

Instantly share code, notes, and snippets.

View mrcolts's full-sized avatar
💖
Remain in history since 2013

MrColT mrcolts

💖
Remain in history since 2013
View GitHub Profile
@mrcolts
mrcolts / 0_reuse_code.js
Created May 3, 2017 09:03
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@mrcolts
mrcolts / regexp.php
Created July 27, 2020 08:28 — forked from Andrew8xx8/regexp.php
Полезные регулярные выражения
<?php
/*
* Юзернейм
*
* Буквы, цифры, дефисы и подчёркивания, от 3 до 16 символов.
* Начинаться должно всегда с буквы латинского алффавита
*/
preg_match('%^[a-z][a-z0-9_-]{3,16}$%', $userName);
/*
@mrcolts
mrcolts / phpmyadmin
Created July 27, 2020 08:29 — forked from tsolar/phpmyadmin
phpmyadmin nginx config
server {
location /phpmyadmin {
root /usr/share/;
index index.php index.html index.htm;
location ~ ^/phpmyadmin/(.+\.php)$ {
try_files $uri =404;
root /usr/share/;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
@mrcolts
mrcolts / .htaccess_slash
Created July 27, 2020 08:29 — forked from s2ar/.htaccess_slash
Убрать слеши в htaccess
#Правило обрабатывает внутренние страницы
# http://site.ru/catalog////item///
RewriteCond %{REQUEST_URI} ^(.*)/{2,}(.*)$
#Проверяем, повторяется ли слеш (//) более двух раз.
RewriteRule . %1/%2 [R=301,L]
#Исключаем все лишние слеши.
#удаляем слеши для главной http://site.ru/////
RewriteCond %{THE_REQUEST} ([^\s]*)\/{2,}(\?[^\s]*)?
RewriteRule (.*) / [R=301,L]