Skip to content

Instantly share code, notes, and snippets.

View mcjwsk's full-sized avatar

Dariusz Maciejewski mcjwsk

View GitHub Profile
[
{
"DestinationCode":"GD-821348-08-69",
"StreetName":"KOŁOBRZESKA 41",
"City":"Gdańsk",
"District":"Gdańsk",
"Longitude":"18.5880",
"Latitude":"54.4038",
"Province":"Pomorskie",
"CashOnDelivery":"false",
<?php
$quote = Mage::getModel('sales/quote')->load(123);
echo $quote->getShippingAddress()->getDiscountAmount();
<?php
require_once 'app/Mage.php';
Mage::app();
/** @var Enterprise_Rma_Model_Rma $rma */
$rma = Mage::getModel('enterprise_rma/rma')->load(135215);
$qtys = array();
/** @var Enterprise_Rma_Model_Item $item */
#!/bin/bash
base_dir="$PWD"
changed_modules=$(git submodule summary | grep '^*' | cut -d ' ' -f 2,3)
echo "$changed_modules" | while read dir commits; do
cd "$dir"
git diff --name-only "$commits" | sed -e "s#^#$dir/#g"
cd "$base_dir"
done
@mcjwsk
mcjwsk / change-dropdown-attribute-to-multiselect.sql
Last active March 29, 2017 12:01 — forked from dinhkhanh/change-dropdown-attribute-to-multiselect.sql
Magento change dropdown attribute to multiselect
UPDATE eav_attribute SET
entity_type_id = 4,
attribute_model = NULL,
backend_model = 'eav/entity_attribute_backend_array',
backend_type = 'varchar',
backend_table = NULL,
source_model = NULL,
frontend_model = NULL,
frontend_input = 'multiselect',
frontend_class = NULL
<?php
require_once 'app/Mage.php';
Mage::app();
$quote = Mage::getModel('sales/quote')->load(197643);
/** @var Mage_Sales_Model_Quote_Item $item */
foreach ($quote->getAllVisibleItems() as $item) {
$option = $item->getOptionByCode('additional_options');
$additonalOptions = array();
@mcjwsk
mcjwsk / .bash_profile
Last active January 8, 2019 08:34 — forked from pablete/.bash_profile
Change iTerm2 profile (ie: background color) when SSHing into another machine
# Changing iTerm2 color in MacOSX when SSHing (so you know at a glance that you're no longer in Kansas)
# Adapted from https://gist.github.com/porras/5856906
# 1. Create a theme in your terminal setting with the name "SSH" and the desired colors, background, etc.
# 2. Add this to your .bash_profile (or .bashrc, I always forget the difference ;))
# 3. Optional but useful: in the terminal, go to Settings > Startup and set "New tabs open with" to
# "default settings" (otherwise, if you open a new tab from the changed one, you get a local tab with
# the SSH colors)
function tabc() {
local name=$1; if [ -z "$name" ]; then name="Default"; fi # if you have trouble with this, change
wget https://github.com/FiloSottile/mkcert/releases/download/v1.4.2/mkcert-v1.4.2-linux-amd64 \
&& mv mkcert-v1.4.2-linux-amd64 mkcert \
&& chmod +x mkcert \
&& sudo cp mkcert /usr/local/bin/
@mcjwsk
mcjwsk / MySQL Replication Check
Created March 11, 2022 10:45 — forked from OliverBailey/MySQL Replication Check
Just a simple Mysql Replication Health Check script I wrote. You can put this in a cron.
#!/bin/bash
### VARIABLES ### \
EMAIL=""
SERVER=$(hostname)
MYSQL_CHECK=$(mysql --login-path=mysql_login -e "SHOW VARIABLES LIKE '%version%';" || echo 1)
STATUS_LINE=$(mysql --login-path=mysql_login -e "SHOW SLAVE STATUS\G")"1"
LAST_ERRNO=$(grep "Last_Errno" <<< "$STATUS_LINE" | awk '{ print $2 }')
SECONDS_BEHIND_MASTER=$( grep "Seconds_Behind_Master" <<< "$STATUS_LINE" | awk '{ print $2 }')
IO_IS_RUNNING=$(grep "Slave_IO_Running:" <<< "$STATUS_LINE" | awk '{ print $2 }')
#!/bin/bash
# basic stuff
sudo apt install -y file-roller gnome-tweaks simple-scan htop git git-flow gnome-shell-extension-manager colordiff webp
# fonts
sudo apt install -y fonts-open-sans
mkdir -p ~/.fonts/adobe-fonts/source-code-pro
git clone --depth=1 https://github.com/adobe-fonts/source-code-pro.git ~/.fonts/adobe-fonts/source-code-pro
fc-cache -f -v ~/.fonts/adobe-fonts/source-code-pro