This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
Source: https://downloads.mailchimp.com/js/mc-validate-messages.js | |
Reason: Couldn't find "Please choose an option.". | |
Ended up discovering it myself, beautified the js link: | |
https://s3.amazonaws.com/downloads.mailchimp.com/js/mc-validate.js | |
Also found: | |
zipcodeUS: "The specified US ZIP Code is invalid", | |
skip_or_fill_minimum: "Please either skip these fields or fill at least {0} of them.", | |
skip_or_complete_group: "Please supply missing fields.", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#run multiple concurrent connections to speed up cache warming | |
#install eliashaeussler/cache-warmup | |
mkdir cache-warmer-elias | |
cd cache-warmer-elias | |
composer require eliashaeussler/cache-warmup | |
#run it |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//set your indexer to update on schedule | |
//and make sure your cronjob for magento is running | |
header("Content-type: text/plain"); | |
//Assuming the php script is in pub/ subfolder. You can put it wherever. | |
chdir(__DIR__.'/../'); | |
$out = shell_exec('php bin/magento indexer:reset'); | |
echo("\n".$out."\n"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import pandas as pd | |
import numpy as np | |
import csv | |
#get every 10000 rows | |
#group by 0,1,2,3,4,... | |
#df2[np.arange(len(df2))//10000==0].to_csv('out0.csv', index=False) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# 1. prepare a sitemap url for the site in magento 2 | |
# 2. download M2-crawler.sh from https://docs.litespeedtech.com/lscache/litemage/crawler/ | |
# 3. add this script. it will run for 43200 seconds (12 hours) and stop. | |
cd "$(dirname "$0")" | |
#timeout after x seconds | |
echo "Starting litemage crawler script in $PWD" | |
timeout 43200 bash M2-crawler.sh -m -r https://example.com/media/sitemap.xml || echo "Process Litemage crawler timed out" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
error_reporting(E_ALL); | |
ini_set('display_errors', 1); | |
use Magento\Framework\App\Bootstrap; | |
function prepareCsv($csvData, $filename = "exportDataExample.csv", $delimiter = ',', $enclosure = '"'){ | |
$f = fopen('php://memory', 'w'); | |
$first = true; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
printf("<pre>\n"); | |
$secStep = 5; | |
$a = strtotime("2020-09-24 07:04:35 UTC"); | |
$b = strtotime("2020-09-24 07:05:50 UTC"); | |
var_dump($a); | |
var_dump($b); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
declare(strict_types=1); | |
//see results: | |
//using declare(strict_types=1): https://3v4l.org/XJYlJ | |
//commented out declare(strict_types=1): https://3v4l.org/1bD85 | |
class Fruit { | |
// Properties | |
private string $name; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// date/time variables using CarbonImmutable: https://carbon.nesbot.com/docs/ | |
//set user time zone | |
$userTimeZone = 'Europe/London'; | |
//======================= UTC ============================================== | |
//now in UTC | |
//CarbonImmutable i.e. don't change the hour value when switching timezones | |
$nowUTC = CarbonImmutable::now('UTC'); | |
//$nowUTC = CarbonImmutable::parse('2020-05-31 23:12:58 UTC'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -e | |
SCRIPTDIR=$(dirname "$0") | |
SCRIPTREALPATH=$(realpath $(dirname "$0")) | |
#cd "$SCRIPTDIR" | |
#echo $SCRIPTREALPATH |
NewerOlder