Skip to content

Instantly share code, notes, and snippets.

View rafaelpatro's full-sized avatar

Rafael Patro rafaelpatro

  • Lisbon, Portugal
View GitHub Profile
@rafaelpatro
rafaelpatro / 2019-https-localhost.md
Created December 13, 2020 18:45 — forked from cecilemuller/2019-https-localhost.md
How to create an HTTPS certificate for localhost domains

How to create an HTTPS certificate for localhost domains

This focuses on generating the certificates for loading local virtual hosts hosted on your computer, for development only.

Do not use self-signed certificates in production ! For online certificates, use Let's Encrypt instead (tutorial).

@rafaelpatro
rafaelpatro / http2_apache2_ubuntu18.04.md
Created April 9, 2020 01:21 — forked from GAS85/http2_apache2_ubuntu18.04.md
How to Enable HTTP/2 in Apache 2.4 on Ubuntu 18.04

Based on https://gist.github.com/GAS85/990b46a3a9c2a16c0ece4e48ebce7300

Requirements

  • A self-managed VPS or dedicated server with Ubuntu 18.04 running Apache 2.4.xx.
  • A registered domain name with working HTTPS (TLS/SSL). HTTP/2 only works alongside HTTPS because most browsers, including Firefox and Chrome, don’t support HTTP/2 in cleartext (non-TLS) mode.

Step 1: Install Apache2

Per default it will be apache2 version 2.4.29 what is enought for http2 support.

@rafaelpatro
rafaelpatro / http2_apache2_ubuntu16.04.md
Created April 9, 2020 01:19 — forked from GAS85/http2_apache2_ubuntu16.04.md
How to Enable HTTP/2 in Apache 2.4 on Ubuntu 16.04

Requirements

  • A self-managed VPS or dedicated server with Ubuntu 16.04 running Apache 2.4.xx.
  • For Ubuntu 18.04 please read here --> https://gist.github.com/GAS85/8dadbcb3c9a7ecbcb6705530c1252831
  • A registered domain name with working HTTPS (TLS/SSL). HTTP/2 only works alongside HTTPS because most browsers, including Firefox and Chrome, don’t support HTTP/2 in cleartext (non-TLS) mode.
@rafaelpatro
rafaelpatro / firecheckout-brazillian-address-autocomplete.js
Last active November 13, 2019 19:49
Magento Brazilian Address Autocomplete (Firecheckout compatible)
window.addEventListener('load', function(){
Postmon = {
data: {},
uf: {AC:"Acre",AL:"Alagoas",AP:"Amapá",AM:"Amazonas",BA:"Bahia",CE:"Ceará",DF:"Distrito Federal",ES:"Espírito Santo",GO:"Goiás",MA:"Maranhão",MT:"Mato Grosso",MS:"Mato Grosso do Sul",MG:"Minas Gerais",PA:"Pará",PB:"Paraíba",PR:"Paraná",PE:"Pernambuco",PI:"Piauí",RJ:"Rio de Janeiro",RN:"Rio Grande do Norte",RS:"Rio Grande do Sul",RO:"Rondônia",RR:"Roraima",SC:"Santa Catarina",SP:"São Paulo",SE:"Sergipe",TO:"Tocantins"},
autofill: function() {
if ($j('#billing\\:street1').val().trim() == '' && typeof this.data.logradouro != 'undefined') {
$j('#billing\\:street1').val(this.data.logradouro);
}
if ($j('#billing\\:street4').val().trim() == '' && typeof this.data.bairro != 'undefined') {
@rafaelpatro
rafaelpatro / notes.md
Created October 26, 2018 13:50 — forked from inecmc/notes.md
How to run multiple Redis instances on Ubuntu 16.04

Create the directory for the new instance

$ sudo install -o redis -g redis -d /var/lib/redis2

Create a new configuration file

$ sudo cp -p /etc/redis/redis.conf /etc/redis/redis2.conf
## How to install mcrypt in php7.2
##
## https://lukasmestan.com/install-mcrypt-extension-in-php7-2/
##
#
# Check version php and pecl
#
php -v # if default php is not 7.2 then use /usr/bin/php7.2 instead php
#!/bin/bash
URL='domain.com'
wget --quiet http://$URL/sitemap.xml --no-cache --output-document - | egrep -o "http://$URL[^<]+" | while read line; do
time curl -A 'Cache Warmer' -s -L $line > /dev/null 2>&1
echo $line
done
@rafaelpatro
rafaelpatro / jquery.qDefer.min.js
Created October 23, 2017 00:25 — forked from RonnyO/jquery.qDefer.min.js
Simply mimic the 'defer' attribute for inline scripts across all browsers (jQuery helper)
// http://bit.ly/qDefer
$(function(){$('script[type="text/javascript/defer"]').each(function(){$(this).clone().attr('type','').insertAfter(this)})});
@rafaelpatro
rafaelpatro / magento-xhrcart.js
Last active February 22, 2018 13:11
Add ajax compatibility to Magento action buttoms
/**
* Add XHR compatibility to Magento action buttoms
*
* Author:
* Rafael Patro <[email protected]>
*
* Requirements:
* DOMParser HTML fixes
* jQuery Growl library
*
@rafaelpatro
rafaelpatro / html-domparser.js
Created June 8, 2017 01:38 — forked from eligrey/html-domparser.js
DOMParser HTML extension - Now a polyfill since HTML parsing was added to the DOMParser specification
/*
* DOMParser HTML extension
* 2012-09-04
*
* By Eli Grey, http://eligrey.com
* Public domain.
* NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
*/
/*! @source https://gist.github.com/1129031 */