Skip to content

Instantly share code, notes, and snippets.

https://magento.stackexchange.com/questions/159815/how-to-show-default-payment-method-as-checked-at-checkout-page-in-magento-2
https://magento.stackexchange.com/questions/148170/magento-2-store-switcher-error-in-section-config-js-uncaught-typeerror-cannot
@elfeffe
elfeffe / gist:ee5dbd2b19e1f5f2a3760026b7cbef10
Created February 11, 2020 04:05
Move MongoDB collection to another server oneliner version
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 February 10, 2020 23:43 — forked from wpottier/show-indexes.js
MongoDB copy indexes
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)) {
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 August 6, 2019 16:20
Ubuntu resize images recursively if they are over 1mb
find . -type f -name "*.jpg" -size +1000k -exec mogrify -resize 1024x1024\> -strip -resample 80 {} \;
<?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 April 18, 2019 17:17 — 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.
<?php
/**
* Classes source autoload
*/
class Varien_Autoload
{
/** @var \Composer\Autoload\ClassLoader */
private static $autoloader;
/** @var self */
@elfeffe
elfeffe / gist:d1f882368330d46ee7c53b88bcdc685b
Created January 26, 2019 15:10
Move MySql Database from one server to another in one single line
mysqldump db_name | mysql -h 'other_hostname' db_name
find /var/www/ -name \*.php | xargs grep -l "ALREADY_RUN_1bc29b36f342a82aaf6658785356718" | xargs rm