Skip to content

Instantly share code, notes, and snippets.

View rossmc's full-sized avatar

Ross rossmc

  • Monsoon Consulting
  • Palma de Mallorca
View GitHub Profile
@rossmc
rossmc / bash_arr.sh
Created March 7, 2018 10:04
Bash script for running commands on array of files etc. Useful for running diff commands on files from different directories.
#!/bin/bash
# cmd='diff -qur -I ".*2006.*"'
# cmd='diff'
# cmd='git diff'
cmd='diff -q'
# cmd='cp'
# cmd='rm'
# cmd='echo diff'
# cmd='ls -alh'
@rossmc
rossmc / .stylelintrc.json
Last active February 6, 2021 12:56
Stylelint configuration object for Magento 2 Projects based on their coding standards http://devdocs.magento.com/guides/v2.0/coding-standards/code-standard-less.html
{
"rules": {
"indentation": 4,
"block-opening-brace-space-before": "always",
"block-opening-brace-newline-after": "always",
"block-closing-brace-newline-before": "always",
"selector-list-comma-newline-after": "always",
"string-quotes": "single",
"selector-combinator-space-after": "always",
"selector-combinator-space-before": "always",
@rossmc
rossmc / Magento-Attr.phtml
Created September 3, 2014 15:41
Add a Magento Attribute to a Template
<?php $_nutritional_info = $this->getProduct()->getNutritional_info(); ?>
<?php if ($_nutritional_info): ?>
<div class="std">
<?php echo $this->helper('catalog/output')->productAttribute($this->getProduct(), $_nutritional_info, 'usage') ?>
</div>
<?php endif; ?>
@rossmc
rossmc / magento.phtml
Last active August 29, 2015 14:05
Magento PHTML
<!-- http://magento-code-snippets.tumblr.com/ -->
<!-- Getting Images -->
<img src="<?php echo $this->getSkinUrl('images/helo.png');?>" alt="helo"/> <!-- From Skin Folder -->
<img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA). 'subfolder/image.png'; ?>" /> <!-- From Media Folder -->
<!-- note: Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) returns a path of www.yourwebsite.com/media -->
<img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK). 'media/subfolder/image.png'; ?>" /> <!-- From Media Folder -->
<!-- note: Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK) returns a path of www.yourwebsite.com -->
@rossmc
rossmc / magento-cms.scss
Created August 28, 2014 10:35
makes images & tables responsive on Magento cms pages
// makes images & tables responsive in cms pages
body.cms-page-view .main{
@media screen and (max-width: $bp-s) {
img {
float: none !important;
text-align: center;
min-width: 65%;
}
table, thead, tbody, th, td, tr {
display: block;
@rossmc
rossmc / snippits.js
Last active August 29, 2015 14:05
useful javascript
$(document).ready(function(){
// http://underscorejs.org/ for lots of useful functions
var jQuery = jQuery.noConflict(); // resolve jQuery conflict
// back previous URL on blog post page
$('#browse-back-btn').click(function(){
window.history.back();
});
@rossmc
rossmc / local.xml
Last active August 29, 2015 14:05 — forked from Maksold/local.xml
Useful Magento Layout xml
<?xml version="1.0"?>
<layout>
<default>
<!--Root/Default Layouts-->
<reference name="root">
<!--Appending Block-->
<block type="page/html_breadcrumbs" name="breadcrumbs" as="breadcrumbs"/>
</reference>
<!--CSS and JS Files-->