Skip to content

Instantly share code, notes, and snippets.

View leonidaswander's full-sized avatar

Leonidas Wander leonidaswander

View GitHub Profile
@grgbrasil
grgbrasil / estilo-cupom-fiscal.markdown
Created October 16, 2021 17:27
estilo cupom fiscal
<?php
/**
* Leitor emails Imap com download de anexo
* extension=php_imap.dll
*/
/* realiza a conexão com as suas credenciais */
$mailbox = '{meuhost.com.br:993/imap/ssl}INBOX';
$username = 'emailt@meuhost.com.br';
@leonidaswander
leonidaswander / mascaras-javascript
Last active March 28, 2019 03:14
Diversas Mascaras com ER JavaScript
//Basta atribuir a classe respectiva no input
$('.telefone').on('keyup', function() {
mascara(this, mascara_tel);
$(this).attr('maxlength','15');
});
$('.cpf').on('keyup', function() {
mascara(this, mascara_cpf);
$(this).attr('maxlength','14');
@leonidaswander
leonidaswander / input-select-estados-brasil
Last active March 20, 2021 13:37
Input select html com lista de estados do Brasil
<select name="frm_select_estados">
<option value="AC">Acre</option>
<option value="AL">Alagoas</option>
<option value="AP">Amapá</option>
<option value="AM">Amazonas</option>
<option value="BA">Bahia</option>
<option value="CE">Ceará</option>
<option value="DF">Distrito Federal</option>
<option value="ES">Espírito Santo</option>
<option value="GO">Goiás</option>
@jeherve
jeherve / plugin.php
Last active September 30, 2021 10:31
Remove state field from woocommerce checkout form.
<?php
/**
* Remove state field from woocommerce checkout form.
*
* @see https://github.com/woocommerce/woocommerce/blob/3.1.2/includes/class-wc-countries.php#L629
*
* @param array $fields Array of default address fields.
*/
function jeherve_remove_state_field( $fields ) {
unset( $fields['state'] );
@seoagentur-hamburg
seoagentur-hamburg / .htaccess
Last active May 3, 2024 10:07
UPDATE 2024/03: Perfect .htaccess file for highspeed and security. You can use it for every WordPress-Website without problems. Highspeed and Security - testet on hundreds of Websites. If you are using a WordPress Multisite, change the last part of this file.
########################################################################
# OPTIMAL .htaccess FILE FOR SPEED AND SECURITY @Version 2.0.9 - 03/2024
# ----------------------------------------------------------------------
# @Author: Andreas Hecht
# @Author URI: https://seoagentur-hamburg.com
# License: GNU General Public License v2 or later
# License URI: http://www.gnu.org/licenses/gpl-2.0.html
########################################################################
@rafael-neri
rafael-neri / validar_cpf.php
Last active April 27, 2024 21:49
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;
@cryptexvinci
cryptexvinci / woo_rename_checkout.php
Last active December 20, 2023 09:48
Rename WooCommerce checkout field label & placeholder
<?php
// WooCommerce Rename Checkout Fields
add_filter( 'woocommerce_checkout_fields' , 'custom_rename_wc_checkout_fields' );
// Change placeholder and label text
function custom_rename_wc_checkout_fields( $fields ) {
$fields['billing']['billing_first_name']['placeholder'] = 'Wonka';
$fields['billing']['billing_first_name']['label'] = 'Your Awesome First Name';
return $fields;
}
@guiliredu
guiliredu / pagseguro-assinatura.php
Last active August 1, 2023 01:05
Exemplo de pagamento e assinatura pelo PagSeguro com PHP e CURL
<?php
$url = 'https://ws.pagseguro.uol.com.br/v2/pre-approvals/request';
$data['email'] = 'email_vendedor@gmail.com';
$data['token'] = 'TOKEN';
$data['currency'] = 'BRL';
$data['reference'] = $id_cliente;
$data['senderName'] = $cliente['nome'];
function telefone_validation(telefone) {
//retira todos os caracteres menos os numeros
telefone = telefone.replace(/\D/g, '');
//verifica se tem a qtde de numero correto
if (!(telefone.length >= 10 && telefone.length <= 11)) return false;
//Se tiver 11 caracteres, verificar se começa com 9 o celular
if (telefone.length == 11 && parseInt(telefone.substring(2, 3)) != 9) return false;