Skip to content

Instantly share code, notes, and snippets.

View tallesairan's full-sized avatar
🏠
Working from home

Talles Airan tallesairan

🏠
Working from home
View GitHub Profile
@tallesairan
tallesairan / pagseguro_error.js
Created December 13, 2018 12:19
Tabela de erros pagseguro
function erroPS($eV) {
let $err = '';
switch($eV)
{
case "5003": $err = "Falha de comunicação com a instituição financeira"; break;
case "10000": $err = "Marca de cartão de crédito inválida"; break;
case "10001": $err = "Número do cartão de crédito com comprimento inválido"; break;
case "10002": $err = "Formato da data inválida"; break;
case "10003": $err = "Campo de segurança CVV inválido"; break;
case "10004": $err = "Código de verificação CVV é obrigatório"; break;
@tallesairan
tallesairan / .htaccess
Created December 7, 2018 16:51
allow http basic auth on htaccess
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
</IfModule>
@tallesairan
tallesairan / _my_account.php
Created December 4, 2018 12:27
Custom login and my account wordpress html
<?php
$cadastro = (get_page_by_title( "Faça seu cadastro")) ? get_page_by_title( "Faça seu cadastro")->ID : 89;
if ( is_user_logged_in() ) {
$user = wp_get_current_user();
$billing_postcode = get_field( 'billing_postcode', get_current_user_id() );
$billing_number = get_field( 'billing_number', get_current_user_id() );
$billing_street = get_field( 'billing_street', get_current_user_id() );
$billing_phone = get_field( 'billing_phone', get_current_user_id() );
$billing_neighborhood = get_field( 'billing_neighborhood', get_current_user_id() );
@tallesairan
tallesairan / estados-acf
Created November 30, 2018 12:47
acf estados
Selecione seu estado
AC : Acre
AL : Alagoas
AP : Amapá
AM : Amazonas
BA : Bahia
CE : Ceará
DF : Distrito Federal
ES : Espírito Santo
GO : Goiás
@tallesairan
tallesairan / estados.html
Last active November 30, 2018 12:48
Select de estados brasileiros
<select class="select-control" id="field_5c012a2b5e7d0" name="acf[field_5c012a2b5e7d0]">
<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>
@tallesairan
tallesairan / mobileAndTabletcheck.js
Created October 1, 2018 14:40
check if is mobile and tablet javascript
window.mobileAndTabletcheck = function() {
var check = false;
(function(a){if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01
@tallesairan
tallesairan / observer.js
Last active September 26, 2018 13:48
Class change Observer with MutationObserver read more at https://developer.mozilla.org/pt-BR/docs/Web/API/MutationObserver
/// read more at
var $div = $(".card");
var observer = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) {
if (mutation.attributeName === "class") {
var attributeValue = $(mutation.target).prop(mutation.attributeName);
console.log("Class attribute changed to:", attributeValue);
console.log($(mutation.target));
$( document ).trigger( "validateCard", attributeValue );
}
@tallesairan
tallesairan / query-acf-field.php
Created September 25, 2018 14:25
Query posts by ACF Repeater field, change repeaterName for your repeater name
/**
* Allow hooking into ACF repeated fields with meta queries
*/
function repeaterAdapter( $where ) {
$where = str_replace("meta_key = 'repeaterName_$", "meta_key LIKE 'repeaterName_%", $where);
return $where;
}
@tallesairan
tallesairan / text-gradient.css
Created September 19, 2018 12:16
text gradient css
.text-gradient {
background-blend-mode: soft-light;
background-image: linear-gradient(to top, rgb(16, 18, 16), rgb(255, 255, 255)), linear-gradient(tan, rgb(212, 181, 120));
-webkit-background-clip: text;
background-clip: text;
-webkit-text-fill-color: transparent;
}
@tallesairan
tallesairan / lastProducts.php
Created September 12, 2018 12:57
lastProducts
<?php
function lastProducts($limit){
$sitesData = get_sites(['number' => 200000000]);
$posts = [];
foreach ( $sitesData as $sites_datumk=>$sites_datum ) {
$st = [];
switch_to_blog( $sites_datum->blog_id );
$st = get_posts([
'post_type'=>'product',
'posts_per_page' => $limit,