Skip to content

Instantly share code, notes, and snippets.

View fillipetech's full-sized avatar

Fillipe Amorim fillipetech

View GitHub Profile
@fillipetech
fillipetech / .bash_profile
Created July 4, 2015 08:07
Bash_profile personalizado com atalhos e configurações
# ---------------------------------------------------------------------------
# Descrição: Este arquivo contém todas as minhas configurações e atalhos personalizados para o Bash
#
# Sessões:
# 1. Configurações Básicas
# 2. Definição de atalhos
# 3. Gerenciamento de arquivos e pastas
# 4. Pesquisa
# 5. Rede
# 6. Operações & Informações
@fillipetech
fillipetech / Adicionar novo campo (custom field) a uma taxonomia (categoria, tag, etc) no WordPress.md Adicionar novo campo (custom field) a uma taxonomia no WordPress (Incluir esse código no functions.php)Nas action_hooks, no lugar de "category" é só incluir o slug da sua taxonomia :)

Adicionar novo campo (custom field) a uma taxonomia (categoria, tag, etc) no WordPress

Incluir esse código no functions.php.

Nas action_hooks, no lugar de "category" é só incluir o slug da sua taxonomia :)

@fillipetech
fillipetech / gist:c6025ecadde0d50dc331609d76f65bc9
Created June 10, 2016 07:41 — forked from joho/gist:3735740
PostgreSQL 9.2 upgrade steps
Steps to install and run PostgreSQL 9.2 using Homebrew (Mac OS X)
(if you aren't using version 9.1.5, change line 6 with the correct version)
1. launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
2. mv /usr/local/var/postgres /usr/local/var/postgres91
3. brew update
4. brew upgrade postgresql
5. initdb /usr/local/var/postgres -E utf8
6. pg_upgrade -b /usr/local/Cellar/postgresql/9.1.5/bin -B /usr/local/Cellar/postgresql/9.2.0/bin -d /usr/local/var/postgres91 -D /usr/local/var/postgres
7. cp /usr/local/Cellar/postgresql/9.2.0/homebrew.mxcl.postgresql.plist ~/Library/LaunchAgents/
@fillipetech
fillipetech / reset_video_visible_area.js
Last active July 17, 2018 18:11
Reset Video on Visible Viewport area #js #jquery #video
/**
* Reset video on visible area
*/
jQuery(document).ready(function($) {
$(window).scroll(function() {
$('video').each(function(){
if ($(this).is(":in-viewport")) {
$(this)[0].play();
} else {
$(this)[0].currentTime = 0;
@fillipetech
fillipetech / extend_user_search.php
Last active July 17, 2018 18:08
Search Users by name and other fields #wp #users
/**
Extend user search in wp-admin
include first_name, last_name and other fields in the search results
**/
add_action('pre_user_query','extend_user_search');
function extend_user_search( $user_query ){
// make sure that this code will be applied only for user search
if ( $user_query->query_vars['search'] ){
$search_query = trim( $user_query->query_vars['search'], '*' );
if ( $_REQUEST['s'] == $search_query ){
@fillipetech
fillipetech / dns_prefetch_metatags.md
Created July 17, 2018 18:23
DNS prefetch #metatags #dns #performance
@fillipetech
fillipetech / force_https_htaccess.md
Created July 17, 2018 18:29
Force HTTPS #htaccess #https #security

HTTPS forced

RewriteEngine On RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L] # END HTTPS
@fillipetech
fillipetech / compress_change_expiration_time.md
Created July 17, 2018 18:32
Compress and Change expiration time #htaccess #performance

EXPIRES HEADER CACHING

insert filter by type (MIME)

AddOutputFilterByType DEFLATE text/plain AddOutputFilterByType DEFLATE text/xml AddOutputFilterByType DEFLATE application/xhtml+xml AddOutputFilterByType DEFLATE text/css AddOutputFilterByType DEFLATE application/xml AddOutputFilterByType DEFLATE image/svg+xml AddOutputFilterByType DEFLATE application/rss+xml AddOutputFilterByType DEFLATE application/atom_xml

@fillipetech
fillipetech / validate_some_fields.js
Created July 17, 2018 18:34
Validate Some Fields #js #jquery #validate
jQuery(window).on('load', function(){
$('#cred_user_form_21174_1').on('submit', function(event) {
var data_telefone = $('[name="wpcf-telefone"]').val();
var data_celular = $('[name="wpcf-celular"]').val();
var data_cnpj = $('[name="wpcf-cnpj"]').val();
var data_ie = $('[name="wpcf-ie-rg"]').val();
var data_cep = $('[name="wpcf-cep"]').val();
@fillipetech
fillipetech / force-https-htaccess.txt
Created July 22, 2018 09:34
Force https #https #security
RewriteEngine On
RewriteCond %{HTTPS} off
# First rewrite to HTTPS:
# Don't put www. here. If it is already there it will be included, if not
# the subsequent rule will catch it.
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Now, rewrite any request to the wrong domain to use www.
# [NC] is a case-insensitive match
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]