Skip to content

Instantly share code, notes, and snippets.

View camaleaun's full-sized avatar

Gilberto Tavares camaleaun

  • Yogh
  • Joinville SC, Brazil
  • 14:49 (UTC -03:00)
View GitHub Profile
@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 / 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 / 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(
{
"require": {
"composer/installers": "^1.6"
},
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "^0.5.0",
"wp-coding-standards/wpcs": "^2.0"
},
"scripts": {
"php:lint": "composer install && vendor/bin/phpcs -p"
@camaleaun
camaleaun / comma.sql
Created August 2, 2019 01:45
Comma group contact mysql select join
CREATE TABLE images (
meta_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
post_id bigint(20) unsigned NOT NULL DEFAULT '0',
image longtext,
PRIMARY KEY (meta_id),
KEY post_id (post_id)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
INSERT INTO images (post_id, image) VALUES (2,'image1.jpg'),(2,'image2.jpg');
@camaleaun
camaleaun / upload.php
Last active June 28, 2019 16:15
Tests file upload in server
<?php
/**
* Uploads tests.
*/
if ( $_POST && isset( $_POST['upload'] ) && ! empty( $_FILES ) ) {
/** Define ABSPATH as this file's directory */
if ( ! defined( 'ABSPATH' ) ) {
define( 'ABSPATH', dirname( __FILE__ ) . '/' );
}
@camaleaun
camaleaun / functions.php
Last active August 13, 2019 22:52
Funcions Utils
<?php
add_filter( 'themename_twbs_bootstrap_defaults', 'themename_twbs_bootstrap_defaults' );
function themename_twbs_bootstrap_defaults( $defaults ) {
$defaults['version'] = '3.3.7';
$defaults['files'] = 'both';
$defaults['cdn'] = 'maxcdn';
$defaults['css_path'] = get_theme_file_uri( 'assets/css' );
$defaults['js_path'] = get_theme_file_uri( 'assets/js' );
return $defaults;