Skip to content

Instantly share code, notes, and snippets.

@alex7r
alex7r / package.json
Created December 9, 2018 14:56
Ultimate load speed mix-config
{
"name": "ultimate-load-speed",
"version": "1.0.0",
"description": "The guideline for better websites.",
"main": "webpack.mix.js",
"scripts": {
"dev": "npm run development -- --env.bundle load && npm run development -- --env.bundle rest",
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"prod": "npm run production -- --env.bundle load && npm run production -- --env.bundle rest",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
@alex7r
alex7r / html
Last active November 1, 2019 14:34
GA GDP
<?php if($_COOKIE['enable_ga'] && $_COOKIE['enable_ga']!='never'){ ?>
<script type="text/javascript">
jQuery( document ).ready(function($) {
function useAnalytics();
});
</script>
<?php
}elseif($_COOKIE['enable_ga']!='never'){ ?>
<div class="letus-use-cookies-for-ga" style="
position: fixed;
@alex7r
alex7r / _ide_helper.php
Created December 19, 2017 08:05
Joomla IDE helper for migration from <3.8
<?php
class JRegistry extends \Joomla\Registry\Registry {}
class JRegistryFormat extends \Joomla\Registry\AbstractRegistryFormat {}
class JRegistryFormatIni extends \Joomla\Registry\Format\Ini {}
class JRegistryFormatJson extends \Joomla\Registry\Format\Json {}
class JRegistryFormatPhp extends \Joomla\Registry\Format\Php {}
class JRegistryFormatXml extends \Joomla\Registry\Format\Xml {}
class JStringInflector extends \Joomla\String\Inflector {}
class JStringNormalise extends \Joomla\String\Normalise {}
@alex7r
alex7r / rabbitmq.txt
Created October 14, 2017 11:37 — forked from sdieunidou/rabbitmq.txt
create admin user on rabbitmq
rabbitmqctl add_user test test
rabbitmqctl set_user_tags test administrator
rabbitmqctl set_permissions -p / test ".*" ".*" ".*"
@alex7r
alex7r / recovernight.reg
Created August 25, 2017 14:21
Recover night mode Windows 10
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\CloudStore\Store\Cache\DefaultAccount\$$windows.data.bluelightreduction.bluelightreductionstate]
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\CloudStore\Store\Cache\DefaultAccount\$$windows.data.bluelightreduction.bluelightreductionstate\Current]
"Data"=hex:02,00,00,00,54,83,08,4a,03,ba,d2,01,00,00,00,00,43,42,01,00,10,00,d0,0a,02,c6,14,b8,8e,9d,d0,b4,c0,ae,e9,01,00
@alex7r
alex7r / 20-xdebug.ini
Last active April 4, 2019 09:06
Setup Xdebug
[Xdebug]
zend_extension="/usr/lib/php/20151012/xdebug.so"
xdebug.idekey="PHPSTORM"
xdebug.remote_enable = 1
xdebug.remote_autostart = 0
xdebug.remote_connect_back = on
xdebug.remote_host = 10.0.2.2
xdebug.renite_enable = 1
xdebug.max_nesting_level = 1000
xdebug.remote_port = 9000
@alex7r
alex7r / composer.sync.php
Last active November 8, 2016 17:18
sketch for composer syncer
<?php
define('JPATH_BASE', __DIR__);
define('EXTRACT_DIRECTORY', JPATH_BASE.DIRECTORY_SEPARATOR.'tmp/composer');
use Composer\Json\JsonFile;
if(!(file_exists(JPATH_BASE.'/libraries/composer.lock') && file_exists(JPATH_BASE.'/libraries/composer.phar') && file_exists(JPATH_BASE.'/libraries/composer.json'))){
die("Seems like composer at joomla isn't initiated, so no need to sync.");
}
if (file_exists(EXTRACT_DIRECTORY.'/vendor/autoload.php') !== true) {
@alex7r
alex7r / snippet.php
Created August 5, 2016 11:02
Change protected property
<?php
$reflectionAppClass = new ReflectionClass($this->app);
$reflectionAppClassProperty = $reflectionAppClass->getProperty('template');
$reflectionAppClassProperty->setAccessible(true);
$reflectionAppClassProperty->setValue($this->app, $template);
<?php
/**
* @package Joomla.Site
* @subpackage com_users
*
* @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
@alex7r
alex7r / list.php
Created July 1, 2016 13:24
pagination limitation of MySQL Calc found rows
<?php /**
* Method to get the starting number of items for the data set.
*
* @return integer The starting number of items available in the data set.
*
* @since 12.2
*/
public function getStart()
{
$store = $this->getStoreId('getstart');