Skip to content

Instantly share code, notes, and snippets.

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

PAULO RICARDO RUBE DE ALMEIDA rickslayer

🏠
Working from home
View GitHub Profile
SELECT
p.ID as order_id,
p.post_date,
max( CASE WHEN pm.meta_key = '_billing_email' and p.ID = pm.post_id THEN pm.meta_value END ) as billing_email,
max( CASE WHEN pm.meta_key = '_billing_first_name' and p.ID = pm.post_id THEN pm.meta_value END ) as _billing_first_name,
max( CASE WHEN pm.meta_key = '_billing_last_name' and p.ID = pm.post_id THEN pm.meta_value END ) as _billing_last_name,
max( CASE WHEN pm.meta_key = '_billing_address_1' and p.ID = pm.post_id THEN pm.meta_value END ) as _billing_address_1,
max( CASE WHEN pm.meta_key = '_billing_address_2' and p.ID = pm.post_id THEN pm.meta_value END ) as _billing_address_2,
max( CASE WHEN pm.meta_key = '_billing_number' and p.ID = pm.post_id THEN pm.meta_value END ) as numero,
max( CASE WHEN pm.meta_key = '_billing_city' and p.ID = pm.post_id THEN pm.meta_value END ) as _billing_city,
@rickslayer
rickslayer / sql
Last active April 14, 2023 12:16
woocommerce_get_principal_user_data.sql
SELECT
wp_users.user_login as login,
wp_users.user_email as email,
firstmeta.meta_value as Nome,
lastmeta.meta_value as sobrenome,
shipping_citymeta.meta_value as cidade,
shipping_postcodemeta.meta_value as CEP,
shipping_statemeta.meta_value as UF,
shipping_phonemeta.meta_value as Telefone,
shipping_address_1meta.meta_value as Endereco,
@rickslayer
rickslayer / remover_menu_admin_wordpress.php
Created December 23, 2020 19:37
Removendo menu admin do wordpress
<?php
function remove_menus()
{
// REMOVE O MENU Comentários
remove_menu_page('edit-comments.php');
}
add_action('admin_init', 'remove_menus');
@rickslayer
rickslayer / bloquear_permitir_comentarios_por_padrao_wordpress.php
Created December 21, 2020 11:44
Bloquear permitir comentários por padrão no wordpress
<?php
function remove_allow_comments_default($data)
{
$data['comment_status'] = 0;
return $data;
}
add_action( 'wp_insert_post_data', 'remove_allow_comments_default', 10, 3 );
@rickslayer
rickslayer / wordpress_mudar_tela_de_login.php
Last active December 16, 2020 21:58
Como mudar a tela de login do Wordpress
<?php
//Arquivo functions.php
function muda_cor_botao(){?>
<style type="text/css">
/*PARA MUDAR O FUNDO DA PÁGINA*/
body{
background:#black !important;
}
@rickslayer
rickslayer / deploy.php
Created September 14, 2020 13:32 — forked from oxguy3/deploy.php
Script used to automatically deploy from GitHub to a cPanel shared hosting server
<?php
/**
* deploy.php by Hayden Schiff (oxguy3)
* Available at https://gist.github.com/oxguy3/70ea582d951d4b0f78edec282a2bebf9
*
* No rights reserved. Dedicated to public domain via CC0 1.0 Universal.
* See https://creativecommons.org/publicdomain/zero/1.0/ for terms.
*/
// random string of characters; must match the "Secret" defined in your GitHub webhook
$(window).on('keydown', function (e) {
if (e.which != 40) return false;
var posicao = $('#destino').position().top;
$('html, body').stop().animate({
scrollTop: posicao
}, 1500);
});
$(function(){
let el = $("#elementoPai").find('input, select');
let cnt = el.filter(function(){
return !$(this).val();
}).length;
if (cnt == el.length){
alert('erro');
}else {
alert('tudoOK');
});
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<script scr="https://code.jquery.com/jquery-3.2.1.min.js"></script>
--Simple Where
Model::where('field', '*operator', 'value').
//*operator = "< , >, =, =>, =< etc"
-- Between where
Model::whereBetween('field',['value1', 'value2']);
-- Raw Where for exclusive treatments
Model::whereRaw('LEFT(field, 4) = tesssttteeee')