Skip to content

Instantly share code, notes, and snippets.

View jbrada's full-sized avatar
🏠
Working from home

Jiří Brada jbrada

🏠
Working from home
View GitHub Profile
@jbrada
jbrada / deploy_split.sh
Last active November 1, 2023 19:11
Repository split
#!/bin/bash
#inspired by k0d3r1s's script
set -euo pipefail
ARG1="${1:-master}"
source_repository="git@github.com:jbrada/magento-monorepo-example.git"
source_branch="$ARG1"
@jbrada
jbrada / cleanup.bash
Last active October 28, 2023 08:40
Consolidation in Action: Moving to a Single Repository System - Cleanup time
#Cleanup remotes
for remote in $(git remote | grep -v '^origin$'); do git remote remove $remote; done
#Cleanup .github directories
cd app/code/Yireo
for dir in */; do rm -rf "${dir}.github"; done
#Commit! :)
git add .
git commit -m "Remove .github directories from all subfolders under app/code/Yireo"
@jbrada
jbrada / focus.bash
Created May 17, 2023 11:46
A tool for disabling websites that causes distraction
#!/bin/bash
hosts_file="/etc/hosts"
temp_file="/tmp/hosts.tmp"
record="127.0.0.1 facebook.com www.facebook.com instagram.com www.instragram.com"
add_record() {
if ! grep -qF "$record" "$hosts_file"; then
echo "$record" | sudo tee -a "$hosts_file" >/dev/null
echo "Record added successfully."
@jbrada
jbrada / error.log
Created July 21, 2022 11:18
Issue in the Bss_ProductLabel module on Magento 2.4.4 (PHP 8.1)
1 exception(s):
Exception #0 (Exception): Deprecated Functionality: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /var/www/html/vendor/bsscommerce/product-label/Helper/Data.php on line 147
@jbrada
jbrada / wow-fake-achievement-generator.php
Last active February 4, 2022 06:24
Wow-fake.com - functions for generation of achievement message
<?php
declare(strict_types=1);
/**
* @param int $achievementId
* @param string $achievementName
* @param DateTime $achievementDate
* @return string
*/
@jbrada
jbrada / OrderDeliveryInterface.php
Created September 18, 2019 12:36
Example Interace
<?php
use Magento\Sales\Model\Order;
interface OderDeliveryInterface
{
public function getDeliveryDate(Order $order): \DateTime;
}
@jbrada
jbrada / print-log-desc.php
Created September 5, 2019 08:46
Large file DESC iteration
<?php
declare(strict_types=1);
$file = fopen(__DIR__ . "/var/log/system.log", "r");
$lineBuffer = '';
for($characterPosition = 0; fseek($file, $characterPosition, SEEK_END) !== -1; $characterPosition--) {
$char = fgetc($file);
if ($char === PHP_EOL) {
@jbrada
jbrada / amasty-shopby-indexer.diff
Last active August 21, 2019 11:51
Fix for amasty/shopby 2.12.8 - EAV indexer stuck at "working"
diff --git a/Plugin/Catalog/Model/Indexer/Product/Eav/Action/Rows.php b/Plugin/Catalog/Model/Indexer/Product/Eav/Action/Rows.php
index 54283dc..92c44d6 100755
--- a/Plugin/Catalog/Model/Indexer/Product/Eav/Action/Rows.php
+++ b/Plugin/Catalog/Model/Indexer/Product/Eav/Action/Rows.php
@@ -12,7 +12,7 @@ use Magento\Catalog\Api\Data\ProductInterface;
use Magento\Framework\EntityManager\MetadataPool;
use Amasty\Shopby\Helper\Group as GroupHelper;
use Magento\Framework\DB\Adapter\AdapterInterface;
-use Magento\Catalog\Model\Indexer\Product\Eav\Action\Row as IndexerEavActionRow;
+use Magento\Catalog\Model\Indexer\Product\Eav\Action\Rows as IndexerEavActionRows;

Digital Ocean Promo Code 2017

Save $10 by this Sign Up link.