Skip to content

Instantly share code, notes, and snippets.

View lloiacono's full-sized avatar

Leandro Loiacono lloiacono

  • Warehousing1
  • Berlin
View GitHub Profile
@lloiacono
lloiacono / AVG orders hour, Count orders hour
Created August 16, 2016 20:54
MySQL queries to calculate AVG and Amount of orders at current hour
#AVG orders at current hour
select AVG(orders_count) as avg_orders_per_hour FROM (
select count(entity_id) as orders_count
from sales_flat_order sfo
where
HOUR(created_at) >= HOUR(now())
AND
HOUR(created_at) <= HOUR(now())
group by DATE(created_at) order by NULL
) avg;
@lloiacono
lloiacono / PopupDictionary.php
Created August 29, 2016 07:32 — forked from blazarecki/PopupDictionary.php
Alert, confirm and prompt with mink
<?php
namespace Widop\Mink\Extension;
/**
* Dictionary to manage popups.
*
* @author Benjamin Lazarecki <[email protected]>
*/
trait PopupDictionary
delimiter ;;
drop procedure if exists build_catalog;;
create procedure build_catalog(IN categories INT, IN products INT)
begin
SET @category_count = 1;
SET @CATNAMEPREFIX = "Category ";
SET @CATURLKEYPREFIX = "cat-";
SET @CATURLPATHPREFIX = "catpath-";
SET @ROOTCATEGORY = 2;
SET @INCLUDEINMENU = 1;
@lloiacono
lloiacono / Grunt Penthouse and Cssmin workflow.md
Created November 30, 2016 08:43
Grunt Penthouse and Css minify for extracting critical Css for embedding into HTML-head

Dutchwebworks Grunt Penthouse & Cssmin workflow

By Dennis Burger, Waddinxveen aug. 2014

This Grunt workflow task is using grunt-penthouse and grunt-contrib-cssmin plugins to extract Critical Path (above-the-fold content) Css from various URL's. This extracted Css can then be (re)inserted as embedded Css (using a HTML <style> -tag) back into the HTML-head of the corresponding webpage.

Using a lazy-loading technique, the other Css files could be loaded into the HTML-DOM later by Javascript. This greatly speeds up the initial page rendering and perception of page speed.

Google PageSpeed Insights recommends inlining this Critical Path Css into the HTML page to stop Css rendering blocking issues in the webbrowser. Website performance (and initial page render speed) are more and more becoming a important search-engine ranking factor.

@lloiacono
lloiacono / nginx.conf
Created December 8, 2016 09:55 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@lloiacono
lloiacono / delete_local_branches.sh
Last active August 16, 2018 16:09
Delete local branches
#!/bin/bash
# Script to loop through local branches and delete them based on user input
for branch in `git branch | grep -v HEAD | grep -v master | grep -v \* | sort`;
do
read -p "Would you like to delete the branch $branch? [Y/n] " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
@lloiacono
lloiacono / Vagrantfile
Last active April 22, 2017 12:18
Template for vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "{{.Box}}"
config.vm.network "private_network", ip: "{{.Ipaddress}}"
@lloiacono
lloiacono / dockerVolCleanUp.sh
Created May 2, 2017 08:04
Remove unused docker volumes
#!/usr/bin/env bash
find '/var/lib/docker/volumes/' -mindepth 1 -maxdepth 1 -type d | grep -vFf <(
docker ps -aq | xargs docker inspect | jq -r '.[]|.Mounts|.[]|.Name|select(.)'
) | xargs -r rm -fr
@lloiacono
lloiacono / .vimrc
Last active January 3, 2018 15:59
.dotfiles
#https://github.com/amix/vimrc
#https://github.com/scrooloose/nerdtree
set runtimepath+=~/.vim_runtime
source ~/.vim_runtime/vimrcs/basic.vim
source ~/.vim_runtime/vimrcs/filetypes.vim
source ~/.vim_runtime/vimrcs/plugins_config.vim
source ~/.vim_runtime/vimrcs/extended.vim
@lloiacono
lloiacono / php-html-css-js-minifier.php
Created July 10, 2017 21:22 — forked from Rodrigo54/php-html-css-js-minifier.php
PHP Function to Minify HTML, CSS and JavaScript
<?php
/**
* -----------------------------------------------------------------------------------------
* Based on `https://github.com/mecha-cms/mecha-cms/blob/master/system/kernel/converter.php`
* -----------------------------------------------------------------------------------------
*/
// HTML Minifier
function minify_html($input) {