Skip to content

Instantly share code, notes, and snippets.

View MostafaNorzade's full-sized avatar
🎯
Focusing

Mostafa Norzade MostafaNorzade

🎯
Focusing
View GitHub Profile
sudo /etc/init.d/apache2 stop
sudo /opt/lampp/lampp start
@MostafaNorzade
MostafaNorzade / Bash_Aliases.example
Last active March 14, 2019 05:46
Bash Aliases Example
## General Things
## -------------------
alias ip="ipconfig getifaddr en0"
alias ipx="curl ipecho.net/plain; echo"
## Git Things
## -------------------
@MostafaNorzade
MostafaNorzade / PHPStorm.xml
Last active June 2, 2023 13:11
PHPStrom Code Style Settings | Setting > Editor > CodeStyle > Scheme > Import Scheme > intillij IDE XML
<code_scheme name="Mostafa">
<option name="OTHER_INDENT_OPTIONS">
<value>
<option name="INDENT_SIZE" value="4" />
<option name="CONTINUATION_INDENT_SIZE" value="8" />
<option name="TAB_SIZE" value="4" />
<option name="USE_TAB_CHARACTER" value="true" />
<option name="SMART_TABS" value="true" />
<option name="LABEL_INDENT_SIZE" value="0" />
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
@MostafaNorzade
MostafaNorzade / Laravel_blade.blade.php
Last active August 3, 2019 07:51
All note for laravel blade
//------------------ page title -------------------------------------
//--------- main.blade.php -------
<title>Laravel | @yield('pageTitle')</title>
//--------- home.blade.php -------
@section('pageTitle', 'Home')
@MostafaNorzade
MostafaNorzade / Laravel_Controller.php
Last active August 3, 2019 07:51
All note for laravel controller
<?php
//-----------------------------------------------
//-------- Controller ---------------------------
//-------------------- resource route ----------
Route::resource('users', 'UserController')->only(['index', 'show']);
Route::resource('users', 'UserController')->except(['destroy']);
// If run below command for create API controller :
@MostafaNorzade
MostafaNorzade / wordpress_plugin.php
Last active February 19, 2020 07:55
Learn wp plugin
https://zarinp.al/91491
<?php
/**
* Plugin Name: My Facebook Tags
* Plugin URI: http://danielpataki.com
* Description: This plugin adds some Facebook Open Graph tags to our single posts.
* Version: 1.0.0
* Author: Daniel Pataki
* Author URI: http://danielpataki.com
<?php
// create middleware with below command :
// php artisan make:middleware My_middelware_name
// then define this in Kernel.php
// we have 2 types middelware : 1-before 2-after
// example for 'before middleware':
public function handle($request, Closure $next)
{
//---------------------- users ---------------------
INSERT INTO laminor.users (id, name, nicename, email, password, created_at)
SELECT ID, display_name, user_nicename, user_email, user_pass, user_registered FROM academy.wp_users;
// ------------------- comments -----------------
DELETE FROM wp_comments WHERE comment_agent = 'WooCommerce';
DELETE FROM wp_comments WHERE comment_approved = 'spam';
DELETE FROM wp_comments WHERE comment_approved = 'trash';
INSERT INTO laminor.comments (id, user_id, created_at, approved, comment, commentable_id, parent_id, commentable_type, author, author_ip, author_email)
DirectoryIndex index.php
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
<?php
//--- update or insert
INSERT INTO MyGuests (id, lastname) VALUES (2, 'Doe')
ON DUPLICATE KEY UPDATE lastname = 'Doe';
UPDATE MyGuests SET lastname='Doe' WHERE id=2
IF ROW_COUNT()=0
INSERT INTO MyGuests (lastname, id) VALUES ('Doe',2);