Skip to content

Instantly share code, notes, and snippets.

View Magento 2 select payment on checkout
https://magento.stackexchange.com/questions/159815/how-to-show-default-payment-method-as-checked-at-checkout-page-in-magento-2
View Magento 2 fix sections.xml problem
https://magento.stackexchange.com/questions/148170/magento-2-store-switcher-error-in-section-config-js-uncaught-typeerror-cannot
@elfeffe
elfeffe / gist:ee5dbd2b19e1f5f2a3760026b7cbef10
Created Feb 11, 2020
Move MongoDB collection to another server oneliner version
View gist:ee5dbd2b19e1f5f2a3760026b7cbef10
mongodump -v --archive --uri="mongodb://localhost:27017/DB_NAME" | mongorestore -v --archive -d DB_NAME --nsFrom DB_NAME.* --nsTo DB_NAME.* --uri="mongodb://DEST_IP:27017/DB_NAME"
@elfeffe
elfeffe / show-indexes.js
Created Feb 10, 2020 — forked from wpottier/show-indexes.js
MongoDB copy indexes
View show-indexes.js
db.getCollectionNames().forEach(function(collection) {
indexes = db[collection].getIndexes();
indexes.forEach(function (c) {
opt = '';
ixkey = JSON.stringify(c.key, null, 1).replace(/(\r\n|\n|\r)/gm,"");
ns = c.ns.substr(c.ns.indexOf(".") + 1, c.ns.length);
for (var key in c) {
if (key != 'key' && key != 'ns' && key != 'v') {
if (opt != '') { opt+= ','}
if (c.hasOwnProperty(key)) {
View PageSpeed Nginx
Original: https://www.webfoobar.com/node/38
Pagespeed Nginx configuration
Create Pagespeed global configuration:
mkdir -p /etc/nginx/apps/pagespeed
vi /etc/nginx/apps/pagespeed/core.conf
@elfeffe
elfeffe / gist:9c7804d26e4aa2d4759ee25b616f1690
Created Aug 6, 2019
Ubuntu resize images recursively if they are over 1mb
View gist:9c7804d26e4aa2d4759ee25b616f1690
find . -type f -name "*.jpg" -size +1000k -exec mogrify -resize 1024x1024\> -strip -resample 80 {} \;
View HorizonDatabaseQueue.php
<?php
namespace App\Libraries\Queue;
use Illuminate\Events\Dispatcher;
use Illuminate\Queue\DatabaseQueue;
use Illuminate\Support\Str;
use Laravel\Horizon\Events\JobDeleted;
use Laravel\Horizon\Events\JobPushed;
use Laravel\Horizon\Events\JobReleased;
@elfeffe
elfeffe / app--code--local--Varien--Autoload.php
Created Apr 18, 2019 — forked from lstrojny/app--code--local--Varien--Autoload.php
Replace Magento autoloader with composer based autoloader. Note: you are losing the ability to use the compiler.
View app--code--local--Varien--Autoload.php
<?php
/**
* Classes source autoload
*/
class Varien_Autoload
{
/** @var \Composer\Autoload\ClassLoader */
private static $autoloader;
/** @var self */
@elfeffe
elfeffe / gist:d1f882368330d46ee7c53b88bcdc685b
Created Jan 26, 2019
Move MySql Database from one server to another in one single line
View gist:d1f882368330d46ee7c53b88bcdc685b
mysqldump db_name | mysql -h 'other_hostname' db_name
View ALREADY_RUN_1bc29b36f342a82aaf6658785356718
find /var/www/ -name \*.php | xargs grep -l "ALREADY_RUN_1bc29b36f342a82aaf6658785356718" | xargs rm