Skip to content

Instantly share code, notes, and snippets.

View camaleaun's full-sized avatar

Gilberto Tavares camaleaun

  • Yogh
  • Joinville SC, Brazil
  • 08:30 (UTC -03:00)
View GitHub Profile
alias wpdebug0='wp config set WP_DEBUG false --raw --type=constant'
alias wpdebug1='wp config set WP_DEBUG true --raw --type=constant'
alias rmdss='find . -name '.DS_Store' -type f -delete'
alias rmnm='find . -name 'node_modules' -type d -delete'
alias rmcv='find . -name 'vendor' -type d -delete'
alias guiau='git update-index --assume-unchange'
alias guinau='git update-index --no-assume-unchange'
alias jpdev1='wp config set JETPACK_DEV_DEBUG true --type=constant --raw'
alias jpdev0='wp config set JETPACK_DEV_DEBUG false --type=constant --raw'
alias wplangupdate='wp language core update && wp language plugin update --all && wp language theme update --all'
@camaleaun
camaleaun / variations.js
Last active October 4, 2021 13:36
Variations script
window.onload = function () {
const variation1 = document.getElementById( 'variation_1' );
const variation2 = document.getElementById( 'variation_2' );
const variation3 = document.getElementById( 'variation_3' );
const withColor = [
'Impressão Vinil',
'Placa Decorativa',
'Impressão Canvas',
'Borda Infinita',
];
@camaleaun
camaleaun / script.js
Created October 30, 2020 14:01
WhatsApp link
function isMobileWA()
{
return (/Android|webOS|iPhone|iPad|iPod|Windows Phone|IEMobile|Mobile|BlackBerry/i.test(navigator.userAgent) );
}
var elm = jQuery('a[href*="whatsapp.com"]');
jQuery.each(elm, function(index, value){
var item = jQuery(value).attr('href');
if(item.indexOf('chat') != -1){
//nothing
} else if (item.indexOf('web.whatsapp') != -1 && isMobileWA()){
@camaleaun
camaleaun / cf7-sales-call.php
Last active October 20, 2020 01:35
Integration Contact Form 7 with Sales Call
<?php
/**
* Integration Contact Form 7 with Sales Call.
*/
function wpcf7_sales_call_register_service() {
$integration = WPCF7_Integration::get_instance();
$integration->add_category(
'call_request',
@camaleaun
camaleaun / .htaccess
Created June 16, 2020 12:31
Redirection old new domain
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^old.com$
RewriteRule (.*)$ https://new.com/$1 [R=301,L]
</IfModule>
@camaleaun
camaleaun / functions.php
Last active May 30, 2020 15:07 — forked from jamesdixon/custom-fonts.php
Wordpress Allow Custom Font Upload
<?php
/**
* Allow fonts upload
*
* @param array $mime_types Current allowed mime types.
* @return array $mime_types Modified mime types.
*/
function allow_upload_fonts_mimes_types( $mime_types ) {
$mime_types = array_merge(
@camaleaun
camaleaun / scripts.js
Created May 29, 2020 14:16
Native sharing
window.addEventListener( 'load', () => {
document.querySelectorAll( '.sharing-anchor' ).forEach( ( anchor ) => {
anchor.addEventListener( 'click', () => {
if ( undefined !== navigator.share ) {
navigator.share( {
title: document.querySelector( 'meta[property="og:title"]' ).content,
text: document.querySelector( 'meta[property="og:description"]' ).content,
url: document.querySelector( 'meta[property="og:url"]' ).content,
} )
}
@camaleaun
camaleaun / devopsopening.md
Last active April 26, 2020 01:52
Setup Nginx web server with PHP and WordPres environment
  1. Connect to server

Only first connection to create username and SSH configure:

$ ssh root@domain

Recomended (most secure):

@camaleaun
camaleaun / cpfcnpj.js
Last active January 7, 2020 20:22
CPF and CNPJ validators
String.prototype.pad = function (length) {
'use strict';
var s = this;
while (s.length < length) {
s = '0' + s;
}
return s;
};
String.prototype.numbers = function () {
'use strict';
@camaleaun
camaleaun / functions.php
Last active November 25, 2019 16:43
Remove accents, lowercase and underscores to dashes
<?php
add_filter( 'sanitize_file_name', 'themename_sanitize_file_name' );
/**
* Remove accents, maybe lowercase and underscores to dashes
*
* @version 1.0.4
* @link https://gist.github.com/camaleaun/d8d12d04ff879a89d833c9eb39362eda
* @param string $filename Name of file.
* @return string Sanitized file name.