Skip to content

Instantly share code, notes, and snippets.

View kl177's full-sized avatar

kl177 kl177

View GitHub Profile
@kl177
kl177 / gist:6089814
Created July 26, 2013 15:32
PHP execution time
$execution_time = microtime();
// code
$execution_time = microtime() - $execution_time;
$execution_time = sprintf('It took %.5f sec', $execution_time);
-=-=-=
$start_time = time();

Magento Code Snippets

Download extension manually using mage

./mage config-set preferred_state stable
./mage clear-cache
./mage sync
./mage download community Module_Name
@kl177
kl177 / gist:6164374
Created August 6, 2013 13:20
javascript utf8 decode
function utf8_decode (str_data) {
// http://kevin.vanzonneveld.net
// + original by: Webtoolkit.info (http://www.webtoolkit.info/)
// + input by: Aman Gupta
// + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// + improved by: Norman "zEh" Fuchs
// + bugfixed by: hitwork
// + bugfixed by: Onno Marsman
// + input by: Brett Zamir (http://brett-zamir.me)
// + bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
@kl177
kl177 / gist:6172449
Last active December 20, 2015 17:59 — forked from klein0r/gist:5441524
@kl177
kl177 / gist:6205490
Created August 11, 2013 16:07
apache config. show all errors. add in .htaccess
php_flag display_errors on
php_flag display_startup_errors on
php_value error_reporting E_ALL
@kl177
kl177 / gist:6209892
Created August 12, 2013 10:56
php header utf-8
header('Content-Type: text/html; charset=utf-8');
@kl177
kl177 / gist:6210651
Created August 12, 2013 13:06
database url for phpstorm (configuring datasource)
jdbc:mysql://localhost:3306/my_db_name?profileSQL=true
@kl177
kl177 / gist:6213933
Last active December 20, 2015 23:39
yandex metrika event
onclick="yaCounterCOUNTER_ID.reachGoal('TARGET_NAME');"
@kl177
kl177 / gist:6235488
Last active December 21, 2015 02:29
Linux shortcuts

Terminal

Log out from the current terminal.

Ctrl + d

Erase the current line. I use this one all the time when I type the wrong command in.

@kl177
kl177 / gist:6438525
Last active December 22, 2015 07:29
Установка x-debug для PhpStorm

Установка x-debug для PhpStorm

set IDE key - "PHPSTORM" and Port - "9000" in Default Settings>PHP>Debug>DBGp Proxy

sudo apt-get install php5-xdebug

edit file: /etc/apache2/conf.d/xdebug.ini add:

xdebug.remote_enable=On #this enables remote debugging