Simple and safe random getters to copy-paste
string randomBytes( int $length )
int randomInt ( int $min , int $max )
string randomUuid ( void )| (function() { | |
| var CSSCriticalPath = function(w, d, opts) { | |
| var opt = opts || {}; | |
| var css = {}; | |
| var pushCSS = function(r) { | |
| if(!!css[r.selectorText] === false) css[r.selectorText] = {}; | |
| var styles = r.style.cssText.split(/;(?![A-Za-z0-9])/); | |
| for(var i = 0; i < styles.length; i++) { | |
| if(!!styles[i] === false) continue; | |
| var pair = styles[i].split(": "); |
| cd /tmp | |
| curl -O http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz | |
| tar zxvf ioncube_loaders_lin_x86-64.tar.gz | |
| PHP_CONFD=$(php-config --configure-options|sed 's/.*\with-config-file-scan-dir\=\(\S*\).*/\1/g') | |
| PHP_VERSION=$(php -r "echo PHP_MAJOR_VERSION.'.'.PHP_MINOR_VERSION;") | |
| PHP_EXT_DIR=$(php-config --extension-dir) | |
| cp "ioncube/ioncube_loader_lin_${PHP_VERSION}.so" $PHP_EXT_DIR | |
| echo "zend_extension = ${PHP_EXT_DIR}/ioncube_loader_lin_${PHP_VERSION}.so" > "${PHP_CONFD}/00-ioncube.ini" | |
| rm -rf ./ioncube | |
| rm ioncube_loaders_lin_x86-64.tar.gz |
| <?php | |
| /** | |
| * Enable sql profiling for each page. | |
| * | |
| * Put code to index file in two parts | |
| */ | |
| // place it BEFORE application run | |
| $profiler = \Magento\Framework\App\ObjectManager::getInstance() | |
| ->get('Magento\Framework\App\ResourceConnection') |
| <?php | |
| // include in bootsrap or add to auto_prepend_file | |
| // tideways extension required (see: https://tideways.io/profiler/docs/setup/installation) | |
| (function () { | |
| if (!function_exists('tideways_enable') | |
| ||!isset($_SERVER['HTTP_ACCEPT']) | |
| || strpos($_SERVER['HTTP_ACCEPT'], 'text/html') === false | |
| ) { | |
| return; |
| <?php | |
| // add to bootstrap.php | |
| register_shutdown_function(function (){ | |
| if (strpos(@$_SERVER['HTTP_ACCEPT'], 'text/html') !== false) { | |
| /** @var \Magento\Framework\App\Resource $adapter */ | |
| $adapter = \Magento\Framework\App\ObjectManager::getInstance() | |
| ->get('Magento\Framework\App\ResourceConnection'); | |
| // composer.phar require "jdorn/sql-formatter:1.3.*@dev" | |
| // require_once '/home/user/.composer/vendor/jdorn/sql-formatter/lib/SqlFormatter.php'; | |
| /** @var Zend_Db_Profiler $profiler */ |
| composer config repositories.alger/phpworld-talk2 vcs [email protected]:davidalger/phpworld-talk2.git | |
| composer require alger/module-skeleton:dev-master | |
| bin/magento setup:upgrade -q && bin/magento cache:flush -q | |
| # OR | |
| git clone [email protected]:davidalger/phpworld-talk2.git app/code/Alger/Skeleton | |
| bin/magento module:enable Alger_Skeleton | |
| bin/magento setup:upgrade -q && bin/magento cache:flush -q |
| # Installation: | |
| # Copy to ~/.config/fish/completions/magento.fish | |
| # Open new or restart existing shell session | |
| # Commands based on Magento 2.0.0-rc and the command | |
| # bin/magento --raw --no-ansi list | |
| # It is a static list since you probably do not have the magento shell script | |
| # in your path. | |
| complete -f -c magento -a --help; | |
| complete -f -c magento -a -h; |
download and install Solr from http://lucene.apache.org/solr/.
you can access Solr admin from your browser: http://localhost:8983/solr/
use the port number used in installation.
| <?xml version="1.0" encoding="UTF-8"?> | |
| <!-- | |
| /** | |
| * Copyright © 2015 Magento. All rights reserved. | |
| * See COPYING.txt for license details. | |
| */ | |
| --> | |
| <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Indexer/etc/indexer.xsd"> | |
| <indexer id="cms_page_grid" view_id="cms_page_grid" primary="cms_page" class="Magento\Indexer\Model\Action\Collection"> | |
| <title translate="true">CMS Page Grid</title> |