Skip to content

Instantly share code, notes, and snippets.

View codekipple's full-sized avatar

codekipple

View GitHub Profile
@codekipple
codekipple / gist:ef7083e595f4cd81eff464398e1798a7
Created May 31, 2017 14:22
Magento modal UI 'clickableOverlay' problem
/*
Close modal because the 'clickableOverlay' method is broken on Magentos modal
Look into fixing this globally and submitting a patch
https://github.com/magento/magento2/issues/7399
*/
$(document).mouseup(function(e) {
var container = $('.my-modal .modal-inner-wrap');
// if the target of the click isn't the container nor a descendant of the container
if (!container.is(e.target) && container.has(e.target).length === 0)
@codekipple
codekipple / image-role.php
Last active May 10, 2017 09:58
Mangento 2, adding a new image role
<?php
// the group name has to be 'Image Management' rather than 'Image' as it has to match the 'attribute_group_code' rather than the 'attribute_group_name' in the 'eav_attribute_group' table.
// See convertToAttributeGroupCode() in \Magento\Eav\Setup\EavSetup
$this->eavSetup->addAttribute(
\Magento\Catalog\Model\Product::ENTITY,
'test_image_role',
[
'group' => 'Image Management',
'type' => 'varchar',
'frontend' => 'Magento\Catalog\Model\Product\Attribute\Frontend\Image',
@codekipple
codekipple / styles.js
Created July 29, 2015 23:40
Gulp example of handling css compilation
var Gulp = require('gulp'),
pkg = require('./../../package.json'),
Sass = require('gulp-sass'),
Postcss = require('gulp-postcss'),
Autoprefixer = require('autoprefixer-core'),
BrowserSync = require('browser-sync');
var cssCompile = function(devMode) {
var outputStyle;
@codekipple
codekipple / gist:96e0774c39a2ce9055f6
Created June 4, 2015 09:09
My favourite tools/plugins for frontend work
## Sliders
http://flickity.metafizzy.co/
http://kenwheeler.github.io/slick/
## Images
https://github.com/aFarkas/lazysizes
https://github.com/scottjehl/picturefill
## shims
https://github.com/scottjehl/iOS-Orientationchange-Fix
@codekipple
codekipple / gist:20e4060d527cf49da87d
Created May 13, 2015 10:50
vertically align things in css
http://zerosixthree.se/vertical-align-anything-with-just-3-lines-of-css/
position: relative;
top: 50%;
transform: translateY(-50%);
# if % value on top does not work use absolute positioning
position: absolute;
top: 50%;
transform: translateY(-50%);
@codekipple
codekipple / gist:688b3f4f8ec00eb0c0c4
Created May 12, 2015 10:59
getting postfix setup as a send mail server on ubuntu using a vagrant VM
This could be unrelated but I'm going to post it here because I had a hard time finding the answer to my question. I was able to get outbound email working from a vagrant virtual box by editing my /etc/resolv.conf to use Google's nameserver rather than the 10.0.x.x IP it was set to:
sudo vi /etc/resolv.conf
Change the nameserver IP:
nameserver 8.8.8.8
Then you'll need to restart postfix:
sudo /etc/init.d/postfix restart
<!-- SHOW SHIPPING RATES-->
<?php $quote = Mage::getModel('sales/quote');
$quote->getShippingAddress()->setCountryId('ES'); // Set your default shipping country here
$_product->getStockItem()->setUseConfigManageStock(false);
$_product->getStockItem()->setManageStock(false);
$quote->addProduct($_product);
$quote->getShippingAddress()->setCollectShippingRates(true);
$quote->getShippingAddress()->collectTotals();
$rates = $quote->getShippingAddress()->getShippingRatesCollection();
// Find cheapest rate
@codekipple
codekipple / gist:aa027893e6f12992bf88
Last active August 29, 2015 14:16
Vagrant networking hanging
Githubhub user https://github.com/Ramblurr says:
https://github.com/mitchellh/vagrant/issues/3860#issuecomment-76380469
For others who stumble across this bug report while searching, this bug has been fixed in Vagrant, but you can still get the "waiting for" delays if you're /etc/networking/interfaces file has extra ifaces in it.
Boot the machine with VBox Gui, wait the three or so minutes for the machine to boot, then login as root and edit /etc/networking/interfaces and make sure it doesn't have duplicate or extra ethX interfaces.
This happened to me when using Varying-Vagrant-Vagrants/VVV and abruptly halting the machine, and fiddling with VBox's network interfaces.
cloud-init-nonet[4.54]: waiting 10 seconds for network device
@codekipple
codekipple / host-dev-stack
Last active August 29, 2015 14:16
Host dev stack
* git (1.9.3) - brew
* npm (v0.12.0) - brew
* grunt-cli - npm
@codekipple
codekipple / TODO
Created January 12, 2015 16:24
symfony console component
* symfony console component, Look into using the symfony component console as part of a WordPress site. Check out wp-cli and see if that's what they are using.