Skip to content

Instantly share code, notes, and snippets.

View asllanmaciel's full-sized avatar
🎯
Focusing

Asllan Maciel asllanmaciel

🎯
Focusing
View GitHub Profile
@asllanmaciel
asllanmaciel / php-funcoes-validacoes.php
Last active June 14, 2022 13:01
Diversas validações para PHP
<?php
function valida_url_preg($url)
{
if (!preg_match('|^http(s)?://[a-z0-9-]+(\.[a-z0-9-]+)*(:[0-9]+)?(/.*)?$|i', $url)) {
return false;
}
}
function valida_url_filter_var($url)
@asllanmaciel
asllanmaciel / validar_cpf.php
Created June 7, 2022 20:16 — forked from rafael-neri/validar_cpf.php
Validar CPF em PHP (Completo)
<?php
function validaCPF($cpf) {
// Extrai somente os números
$cpf = preg_replace( '/[^0-9]/is', '', $cpf );
// Verifica se foi informado todos os digitos corretamente
if (strlen($cpf) != 11) {
return false;
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Cookies</title>
<style>
.cookieConsentContainer {
<?php
// NÃO inclua a tag do PHP acima!
// Coloque isso no arquivo functions.php do seu tema (filho, preferencialmente)
add_filter( 'cfw_get_billing_checkout_fields', 'remove_checkout_fields', 100 );
function remove_checkout_fields( $fields ) {
unset( $fields['billing_company'] );
unset( $fields['billing_city'] );
unset( $fields['billing_postcode'] );
@asllanmaciel
asllanmaciel / elementor-form-additional-webhook.php
Created March 22, 2022 21:08 — forked from csalzano/elementor-form-additional-webhook.php
Elementor Form additional webhook example
<?php
/**
* Plugin Name: Elementor Form Additional Webhook
* Plugin URI: https://gist.github.com/csalzano/dfd754e0fe8b6ac10731fad8f257c0bf
* Description: Adds a second Webhook to an Elementor form
* Version: 1.0.1
* Author: Corey Salzano
* Author URI: https://breakfastco.xyz/
* License: GPLv2 or later
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
@asllanmaciel
asllanmaciel / php-array-bancos.php
Last active June 17, 2022 22:48
Função para retornar array com listagem de bancos com códigos (PHP)
<?php
//funcão para retornar array com listagem de bancos
function bancos(){
$var_banco = array();
$var_banco['246']='Banco ABC Brasil S.A.';
$var_banco['748']='Banco Cooperativo Sicredi S.A.';
$var_banco['117']='Advanced Cc Ltda';
$var_banco['121']='Banco Agibank S.A.';
$var_banco['172']='Albatross Ccv S.A';
@asllanmaciel
asllanmaciel / DNS Prefetch domains
Created October 8, 2021 20:34 — forked from lukecav/DNS Prefetch domains
WP Rocket - Advanced Options Prefetch DNS requests examples
//maps.googleapis.com
//maps.gstatic.com
//fonts.googleapis.com
//fonts.gstatic.com
//ajax.googleapis.com
//apis.google.com
//google-analytics.com
//www.google-analytics.com
//ssl.google-analytics.com
//youtube.com
@asllanmaciel
asllanmaciel / wp_config.php
Created October 7, 2021 00:16 — forked from butlerblog/wp_config.php
Configure WordPress #wp_mail function to send through #SMTP server https://b.utler.co/Y3
<?php
/*
* Set the following constants in wp-config.php.
* These should be added somewhere BEFORE the constant ABSPATH is defined.
*
* Author: Chad Butler
* Author URI: https://butlerblog.com
*
* For more information and instructions, see: https://b.utler.co/Y3
@asllanmaciel
asllanmaciel / delete-orphans-usermeta.sql
Created September 30, 2021 18:26 — forked from carlosleopoldo/delete-orphans-usermeta.sql
Delete all orphans user meta in WordPress
DELETE FROM wp_usermeta
WHERE NOT EXISTS (
SELECT * FROM wp_users
WHERE wp_usermeta.user_id = wp_users.ID
)
SELECT p1.*
FROM prfx_faturas p1
INNER JOIN
(
SELECT MAX(id) MaxID
FROM prfx_faturas
WHERE id_auxiliar = 123
GROUP BY id_gateway_carne
) p2
ON p1.id = p2.MaxID