Skip to content

Instantly share code, notes, and snippets.

View amirhp-com's full-sized avatar
🔥

Amirhossein Hosseinpour amirhp-com

🔥
View GitHub Profile
@amirhp-com
amirhp-com / flywheel-local-xdebug-vscode.md
Created December 17, 2022 09:33 — forked from Niq1982/flywheel-local-xdebug-vscode.md
WordPress debugging with XDebug on Flywheel Local & VSCode

Flywheel Local configuration

Flywheel Local has XDebug installed by default if you choose “Custom” instead of “Preferred” when setting up a new local environment. If you don’t know which your current site is running, you can detect it by going to ”Site Setup” tab. If you can change the PHP version there, you have the “Custom” environment running. If not, just export your site, import it back and choose “Custom”.

Now that we have the right environment, remember what PHP version you are running, open the right PHP settings file (for example /Local Sites/my_site/conf/php/7.0.3/php.ini) and add these lines in the [Xdebug] section:

xdebug.remote_enable=1
xdebug.remote_autostart=1

Save the php.ini and restart your site container in Flywheel to apply new settings.

@amirhp-com
amirhp-com / atom-copy-filename.md
Last active August 15, 2022 07:46 — forked from piascikj/atom-copy-filename.md
Atom copy filename

Use CTRL-SHIFT-A to Copy current filename to clipboard or CTRL-SHFIT-X to insert file name at current position.

Add following code on ~/.atom/keymap.cson
'atom-text-editor':
  'ctrl-shift-a': 'amirhp-com:copy-file-name'
  'ctrl-shift-x': 'amirhp-com:insert-file-name'
Add following code on ~/.atom/init.coffee
@amirhp-com
amirhp-com / Arabic character to Persian (Farsi) - PHP
Created July 15, 2022 10:59 — forked from amirasaran/Arabic character to Persian (Farsi) - PHP
convert Arabic character to Persian (Farsi) - PHP
<?php
public static function arabicToPersian($string)
{
$characters = [
'ك' => 'ک',
'دِ' => 'د',
'بِ' => 'ب',
'زِ' => 'ز',
'ذِ' => 'ذ',
'شِ' => 'ش',
<?php
$args = array(
'label' => '', // Text in Label
'class' => '',
'style' => '',
'wrapper_class' => '',
'value' => '', // if empty, retrieved from post meta where id is the meta_key
'id' => '', // required
'name' => '', //name will set from id if empty
/**
* Validates hex value
* @param {String} color hex color value
* @return {Boolean}
*/
function isValidHex(color) {
if(!color || typeof color !== 'string') return false;
// Validate hex values
if(color.substring(0, 1) === '#') color = color.substring(1);
@amirhp-com
amirhp-com / php-html-css-js-minifier.php
Created May 20, 2020 07:41 — forked from Rodrigo54/php-html-css-js-minifier.php
PHP Function to Minify HTML, CSS and JavaScript
<?php
/**
* -----------------------------------------------------------------------------------------
* Based on `https://github.com/mecha-cms/mecha-cms/blob/master/system/kernel/converter.php`
* -----------------------------------------------------------------------------------------
*/
// HTML Minifier
function minify_html($input) {