Skip to content

Instantly share code, notes, and snippets.

View lnoering's full-sized avatar

Leonardo Noering lnoering

View GitHub Profile
@lnoering
lnoering / estado.php
Created August 6, 2015 18:08
Verificar o Estado pelo Cep.
public function getEstado($cep)
{
$estados = array('ac'=>'69900,69999',
'al'=>'57000,57999',
'am'=>'69000,69299|69400,69899',
'ap'=>'68900,68999',
'ba'=>'40000,48999',
'ce'=>'60000,63999',
'df'=>'70000,72799|73000,73699',
'es'=>'29000,29999',
@lnoering
lnoering / vhost nginx
Last active August 29, 2015 14:26
Vhost para projetos locais com Nginx.
# versao do nginx 1.8.0
server {
listen 80;
server_name ~^(www\.)?(?<sname>.+).local.com.br$;
root /home/projetos/$sname;
error_log /var/logs/$sname.error.log;
access_log /var/logs/$sname.access.log;
@lnoering
lnoering / magento.conf
Created August 7, 2015 16:10
Configuração de vhost para Magento.
## colocar em /etc/nginx
#ini - http://www.magentocommerce.com/magento-connect/speedster-by-fooman.html
rewrite ^/minify/([0-9]+)(/.*.(js|css))$ /lib/minify/m.php?f=$2&d=$1 last;
rewrite ^/skin/m/([0-9]+)(/.*.(js|css))$ /lib/minify/m.php?f=$2&d=$1 last;
#fim - http://www.magentocommerce.com/magento-connect/speedster-by-fooman.html
location ~* \.(eot|ttf|woff)$ {
add_header Access-Control-Allow-Origin "*";
}
@lnoering
lnoering / php.conf
Created August 7, 2015 16:11
Configuração do php-fpm com nginx.
## colocar em /etc/nginx
## php-fpm parsing
location ~ .php$ {
## Catch 404s that try_files miss
if (!-e $request_filename) { rewrite / /index.php last; }
## Disable cache for php files
expires off;
@lnoering
lnoering / gzip.conf
Created August 7, 2015 16:12
Configuração de gzip no vhost.
# colocar em /etc/nginx
##turn on gzip compreesion
gzip on;
gzip_static on;
gzip_comp_level 9;
gzip_min_length 1100;
gzip_types text/plain image/png image/gif image/jpeg application/x-javascript text/css text/xml application/xml application/xml+rss text/javascript;
gzip_vary on;
gzip_http_version 1.1;
@lnoering
lnoering / fedora.txt
Last active August 29, 2015 14:26
Nginx + PHP-FPM no Fedora!
## http://www.if-not-true-then-false.com/2011/install-nginx-php-fpm-on-fedora-centos-red-hat-rhel/
## http://www.itzgeek.com/how-tos/linux/fedora-how-tos/nginx-php-fpm-mariadb-on-fedora-21.html
## Desabilitar o HTTPD ##
systemctl disable httpd.service
## Habilitar o Nginx ##
systemctl enable nginx.service
## Habilitar o FPM para não precisar ficar startando ##
@lnoering
lnoering / Criar SSL.txt
Last active October 20, 2015 11:47
Criar Certificado SSL para Desenvolvimento Local!
## Install OpenSSL ##
yum install openssl openssl-deve
## Criar a pasta para criar os arquivos ##
mkdir ~/domain.com.ssl/
cd ~/domain.com.ssl/
## Criando o .KEY ##
@lnoering
lnoering / exec-sublime.md
Last active March 30, 2017 16:50
[Sublime] Plugins

Usando comando para executar o Sublime

./sublime_text --help Sublime Text 2 Build 2217

Usage: sublime_text [arguments] [files] edit the given files or: sublime_text [arguments] [directories] open the given directories

Arguments: --project : Load the given project

@lnoering
lnoering / dnsmasq.txt
Last active April 28, 2017 13:35
DNSMASQ - Criar apenas um HOST para atender a todos os projetos.
## Config ##
# abrir as configurações do dnsmasq ( sudo vim /etc/dnsmasq.conf ) e adicionar #
address=/local.com.br/127.0.0.1
# reiniciar o dnsmasq #
sudo service dnsmasq restart
# editar o arquivo ( /etc/resolv.conf ) para incluir o local nameserver #
nameserver 127.0.0.1
@lnoering
lnoering / backup-database.sh
Last active April 27, 2017 19:23
[mysql] - Dump. ( Magento )
#!/bin/bash
function startduration {
TIMESTART=$(date +%s.%N)
}
function printduration {
TEMPO=$(python -c "print($(date +%s.%N) - $1)")
TEMPO=(${TEMPO//./ })