Skip to content

Instantly share code, notes, and snippets.

View waynetheisinger's full-sized avatar

Wayne Theisinger waynetheisinger

  • Suffolk
View GitHub Profile
@waynetheisinger
waynetheisinger / memory-usage-log.md
Last active November 28, 2022 17:17 — forked from davidalger/memory-usage-log.md
PHP Memory Usage Log

Setup memory log on php-fpm pool

  1. Added the following to /usr/local/lib/strangecode_php_memory_log.php

     <?php
     function strangecode_php_memory_log()
      {
           date_default_timezone_set('utc');
           $current = memory_get_usage() / 1024 / 1024;
    

$peak = memory_get_peak_usage() / 1024 / 1024;

<?
if ($product->getImage() && $product->getImage()!='no_selection') {
$filePath = 'catalog/product/'.ltrim($product->getImage(), '/');
$data["image_url"] = $this->_helper->getBaserUrl(
$magentoStoreId,
\Magento\Framework\UrlInterface::URL_TYPE_MEDIA
).$filePath;
} elseif ($this->_parentImage) {
$data['image_url'] = $this->_parentImage;
} else {
@waynetheisinger
waynetheisinger / fix-git-line-endings
Last active November 20, 2020 10:02 — forked from ajdruff/fix-git-line-endings
Forces all line endings to LF in your git repo.
#####################
# Why do you want this ? Because Git will see diffs between files shared between Linux and Windows due to differences in line ending handling ( Windows uses CRLF and Unix LF)
# This Gist normalizes handling by forcing everything to use Unix style.
#####################
# Fix Line Endings - Force All Line Endings to LF and Not Windows Default CR or CRLF
# Taken largely from: https://help.github.com/articles/dealing-with-line-endings/
# With the exception that we are forcing LF instead of converting to windows style.
@waynetheisinger
waynetheisinger / media-query.css
Created March 28, 2020 10:17 — forked from gokulkrishh/media-query.css
CSS Media Queries for Desktop, Tablet, Mobile.
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
//CSS
@waynetheisinger
waynetheisinger / it-jonction-promo-banners
Created January 7, 2020 10:46 — forked from sudarshann/it-jonction-promo-banners
it-jonction-promo-banners for floating banner on top
<div hidden id="it-jonction-promo-banners-tag-desktop">
<div id="promo-banners-tag-desktop-block" class="promo-banners-tag hide-on-mobile">
<!-- For Desktop Collapsed view -->
<img
class="img-responsive promo-banners-tag-desktop-block open"
id="desktop-open-code"
src="!!! Change This here !!!"
alt="promo-banners-tag">
<!-- For Desktop Expanded view -->
@waynetheisinger
waynetheisinger / kubernetes_commands.md
Created August 8, 2019 19:53 — forked from edsiper/kubernetes_commands.md
Kubernetes Useful Commands
@waynetheisinger
waynetheisinger / filter_dates_datetimes.php
Created January 30, 2018 08:47 — forked from herveguetin/filter_dates_datetimes.php
Properly manage dates and datetimes in admin form (displaying and saving data in order to make sure to fit to locale in Magento)
<?php
/**
* 1) Make sure to display a correct date or datetime input field in admin forms
*
* Code below is in a _prepareForm() method of an admin form
*/
$dateOutputFormat = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
$fieldset->addField('my_date_field', 'date', array(
'name' => 'my_date_field',
'label' => $this->__('My Date Field'),
@waynetheisinger
waynetheisinger / bundle.php
Last active August 27, 2017 10:12
Create Bundled product programatically
<?php
require_once('includes/config.php');
require_once('app/Mage.php');
$storeID = 1;
$websiteIDs = array(1);
$cats = array(5);
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
/** @var $productCheck Mage_Catalog_Model_Product */
$productCheck = Mage::getModel('catalog/product');
$p = array(
@waynetheisinger
waynetheisinger / intro.md
Last active March 10, 2023 07:21 — forked from derhuerst/intro.md
Installing Git on Linux, Mac OS X and Windows