Skip to content

Instantly share code, notes, and snippets.

View azibom's full-sized avatar
🏕️
Focusing

Mohammad Reza azibom

🏕️
Focusing
View GitHub Profile
# WordPress Dockerfile: Create container from official WordPress image, basic customizations.
# docker build -t wordpress_local:wp_custom_1.0 .

FROM wordpress:latest

# APT Update/Upgrade, then install packages we need
RUN apt update && \
    apt upgrade -y && \
 apt autoremove && \
@azibom
azibom / wordpress_in_subdirectory.md
Last active January 1, 2021 17:48
wordpress in subdirectory

First you install and do all things in blog.example.com and then continue with this instruction
Add this line to the blog.urge.ir

     if ($request_method = 'OPTIONS') {
        add_header 'Access-Control-Allow-Origin' '*';
        add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
        add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
        add_header 'Access-Control-Max-Age' 1728000;
        add_header 'Content-Type' 'text/plain; charset=utf-8';
        add_header 'Content-Length' 0;
@azibom
azibom / elastic.md
Created October 31, 2020 11:37
elastic

Get all indexes:

GET /_cat/indices/

Get all info about the index structure:

GET /<index_name>/_mapping

Get all data that are inside the index:

GET //_search

@azibom
azibom / git_info.md
Created October 31, 2020 11:20
Git info

How rename the branch:

git branch -m <new_name>

How undo the commit:

git reset --soft HEAD~1

How remove the remote branch:

git push -d origin

How sync with the remote branch:

git reset --hard HEAD
git clean -f -x -d -n
@azibom
azibom / phpcs.xml
Last active October 23, 2020 14:11
That is my custom phpcs.xml file
<?xml version="1.0" encoding="UTF-8"?>
<ruleset name="Azibom Phpcs">
<description>
I am Azibom and that is my custom phpcs.xml file
</description>
<file>./src</file>
<rule ref="Generic.Classes.DuplicateClassName"/>
<rule ref="Generic.CodeAnalysis.EmptyStatement"/>
<rule ref="Generic.CodeAnalysis.ForLoopShouldBeWhileLoop"/>
<rule ref="Generic.CodeAnalysis.ForLoopWithTestFunctionCall"/>
@azibom
azibom / php_note_4.md
Created July 21, 2020 13:27
find php.ini path

php -i | grep "Loaded Configuration File"

@azibom
azibom / apt_repository
Created June 28, 2020 17:16
apt repository
/etc/apt/sources.list.d/
/etc/apt/sources.list
@azibom
azibom / laravel_log_permission
Last active June 24, 2020 11:57
laravel log permission
sudo chown -R $USER:www-data storage;
sudo chown -R $USER:www-data bootstrap/cache;
chmod -R 775 storage;
chmod -R 775 bootstrap/cache;
@azibom
azibom / nginx_reverse_proxy
Created June 23, 2020 09:49
nginx reverse proxy
server {
listen 80;
listen [::]:80;
server_name example.com www.example.com;
location / {
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;

What are PHP Namespaces?

Namespacing does for functions and classes what scope does for variables. It allows you to use the same function or class name in different parts of the same program without causing a name collision.

In simple terms, think of a namespace as a person's surname. If there are two people named "John" you can use their surnames to tell them apart.

link