Skip to content

Instantly share code, notes, and snippets.

View bluvertigo's full-sized avatar

Andrea Gentili bluvertigo

View GitHub Profile

cat ~/.ssh/id_rsa.pub | xclip -sel clip

Run composer install:

docker-compose run --rm composer install

Magento bin/magento:

docker-compose exec php bin/magento

Show magento configuration

@bluvertigo
bluvertigo / logical-operator.md
Last active November 23, 2017 11:07 — forked from beezeebly/gist:8153584
Logical Operator

Logical Operators

  • && and (both are true)
  • || or (at least one is true)
  • ! not

AND

true && true
// true
<?
// Discount
$discount = abs($order->getDiscountAmount());
if ($discount > 0) {
$applyTaxAfterDiscount = (int)Mage::getStoreConfig('tax/calculation/apply_after_discount');
$discountIncludesTax = (int)Mage::getStoreConfig('tax/calculation/discount_tax');
if (!$discountIncludesTax && !$applyTaxAfterDiscount) {
} elseif (
(!$discountIncludesTax && $applyTaxAfterDiscount)
@bluvertigo
bluvertigo / touch-event.js
Last active September 8, 2017 13:34
iOS touch event / intercettare evento touch sui device mobile
var dragging = false;
$('.facetapi-facetapi-links > .leaf > a')
.on('touchmove', function(){
dragging = true;
})
.on('touchend', function(){
if (dragging)
return;
})
.on('touchstart', function(){
@bluvertigo
bluvertigo / index.html
Created June 22, 2017 12:43
Bootstrap Modal - Popup - Google Maps
<a href="#" data-lat="23, 18.33" data-toggle="modal" data-target="#myMapModal">
Launch Map Modal
</a>
<div class="modal fade" id="myMapModal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">Modal title</h4>
@bluvertigo
bluvertigo / sort-array-by-name.js
Last active September 8, 2017 13:35
Sort array by name and order
objArray.sort(function(a, b) {
var textA = a.DepartmentName.toUpperCase();
var textB = b.DepartmentName.toUpperCase();
return (textA < textB) ? -1 : (textA > textB) ? 1 : 0;
});
#!/bin/bash
#setup variables
x="/share/cam" #base dir to search
date=$(date +"%Y%m%d%H%M") #date used throughout script
fileprefix="yt_"
ytemail="youremail" #your youtube email account
ytpassword="password" #your youtube password
emailfrom="youremail(Your Name)" #your email address and from name
emailuser="youremail" #your gmail address
emailpassword="password" #your gmail password
@bluvertigo
bluvertigo / string.php
Created May 17, 2017 15:07
Stripping last comma from a foreach loop
<?php
$resultstr = array();
foreach ($results as $result) {
$resultstr[] = $result->name;
}
echo implode(",",$resultstr);
@bluvertigo
bluvertigo / html.md
Last active September 8, 2017 13:35
Bootstrap grid fix

Extend your bootstrap.css with this css:

@media (min-width:1200px){
    .auto-clear .col-lg-1:nth-child(12n+1){clear:left;}
    .auto-clear .col-lg-2:nth-child(6n+1){clear:left;}
    .auto-clear .col-lg-3:nth-child(4n+1){clear:left;}
    .auto-clear .col-lg-4:nth-child(3n+1){clear:left;}
    .auto-clear .col-lg-6:nth-child(odd){clear:left;}
}
@media (min-width:992px) and (max-width:1199px){